[sup][/sup]
Hi Everyone! Hope you're all having a nice life! I'm aware this might be no news but still. As the title states (title suggestions are welcome by the way ) this post is about how to generate and save a *.txt file from command line orders output, and in case you wonder the resulting *.txt files will be saved in your home directory. I'm pretty sure you've heard of histoy>history.txt which saves a text file containing all your bash history, but say you run:
$ cd music, which takes you to the music directory right? Now, wouldn't it be nice to save a list.txt file of all your audio files and anything else in this folder? I certainly think it is. All you have to do is:
music$sudo su
music$pass: your passwd
music$ ls
music$ ls>ls.txt which will generate and save a *.txt file with the contents of the directory.
why root you ask? well, not sure whether or not it has to do with *ls command or that you're working with directories but your non-root user has no permission to perform that action, I think it's harmless, but apparently you're not allowed unless root, maybe someone more experienced than me could explain the why.
I noticed that naming the resulting *.txt the same as the command line order, i.e pactl list cards>pactl list cards.txt won't work but pactl list cards>pactllistcards.txt will. However, I do suggest to use a command/output-related name so it's easier to search/find.
I won't explain what command does what. I'm assuming you already know this, if you don't a quick Google search will help, anyway, here are a few ones I tried:
df -h>df.txt
timedatectl>timedatectl.txt
sensors>sensors.txt
lspci>lspci.txt
pactl list cards>pactllistcards.txt
top>top.txt *I know, this one is probably useless like this, but I thought of trying anyway, however, the *.txt file is quite not readable or at the very least I found it difficult to and you have to wait a couple of seconds for it to come with an output, otherwise you get a blank page, then do ctrl+c to stop so it saves the .txt file.
uname -a>uname.txt
systemd-analyze>boottime.txt
systemd-analyze blame>blame.txt
glxinfo | grep -i render>glxinfo.txt
lsb_release -idc>lsbrelease.tx
printenv>var.txt
command info>info.txt
du -h>du.txt
lscpu>lscpu.txt
cat /proc/cpuinfo>cpuinfo.txt
sudo lshw>lshw.txt *sudo allows to gathers much more information.
lshw>lshw.txt *without the sudo command less information is gathered and you'll see a warning that it might be incomplete and that you should run the command with sudo instead.
sudo lshw -short>lshwshort.txt *same thing as the sudo lshw command above.
lshw -short>lshwshort1.txt *you know by now right?
sudo fdisk -l>fdisk.txt
sudo dmidecode -t memory>dmidecodemem.txt
sudo dmidecode -t system>dmidecodesys.txt
sudo dmidecode -t bios>dmidecodebios.txt
sudo dmidecode -t processor>dmidecodeproc.txt
ifconfig>ifconfig.txt
netstat>netstat.txt
I think that there might be tools which are probably easier and better for this task, but I also think it is quite handy to have these *.txt files so you can compare changes from time to time as well as to keep a record on your files, directory contents as well as some valuable system's information in an easy-friendly approach.
I hope you find this information as useful as it is to me. If you happen to know more ways to take advantage of this handy procedure or better yet, improve it! Please, do share your valuable knowledge with your fellow Linux users
Hi Everyone! Hope you're all having a nice life! I'm aware this might be no news but still. As the title states (title suggestions are welcome by the way ) this post is about how to generate and save a *.txt file from command line orders output, and in case you wonder the resulting *.txt files will be saved in your home directory. I'm pretty sure you've heard of histoy>history.txt which saves a text file containing all your bash history, but say you run:
$ cd music, which takes you to the music directory right? Now, wouldn't it be nice to save a list.txt file of all your audio files and anything else in this folder? I certainly think it is. All you have to do is:
music$sudo su
music$pass: your passwd
music$ ls
music$ ls>ls.txt which will generate and save a *.txt file with the contents of the directory.
why root you ask? well, not sure whether or not it has to do with *ls command or that you're working with directories but your non-root user has no permission to perform that action, I think it's harmless, but apparently you're not allowed unless root, maybe someone more experienced than me could explain the why.
I noticed that naming the resulting *.txt the same as the command line order, i.e pactl list cards>pactl list cards.txt won't work but pactl list cards>pactllistcards.txt will. However, I do suggest to use a command/output-related name so it's easier to search/find.
I won't explain what command does what. I'm assuming you already know this, if you don't a quick Google search will help, anyway, here are a few ones I tried:
df -h>df.txt
timedatectl>timedatectl.txt
sensors>sensors.txt
lspci>lspci.txt
pactl list cards>pactllistcards.txt
top>top.txt *I know, this one is probably useless like this, but I thought of trying anyway, however, the *.txt file is quite not readable or at the very least I found it difficult to and you have to wait a couple of seconds for it to come with an output, otherwise you get a blank page, then do ctrl+c to stop so it saves the .txt file.
uname -a>uname.txt
systemd-analyze>boottime.txt
systemd-analyze blame>blame.txt
glxinfo | grep -i render>glxinfo.txt
lsb_release -idc>lsbrelease.tx
printenv>var.txt
command info>info.txt
du -h>du.txt
lscpu>lscpu.txt
cat /proc/cpuinfo>cpuinfo.txt
sudo lshw>lshw.txt *sudo allows to gathers much more information.
lshw>lshw.txt *without the sudo command less information is gathered and you'll see a warning that it might be incomplete and that you should run the command with sudo instead.
sudo lshw -short>lshwshort.txt *same thing as the sudo lshw command above.
lshw -short>lshwshort1.txt *you know by now right?
sudo fdisk -l>fdisk.txt
sudo dmidecode -t memory>dmidecodemem.txt
sudo dmidecode -t system>dmidecodesys.txt
sudo dmidecode -t bios>dmidecodebios.txt
sudo dmidecode -t processor>dmidecodeproc.txt
ifconfig>ifconfig.txt
netstat>netstat.txt
I think that there might be tools which are probably easier and better for this task, but I also think it is quite handy to have these *.txt files so you can compare changes from time to time as well as to keep a record on your files, directory contents as well as some valuable system's information in an easy-friendly approach.
I hope you find this information as useful as it is to me. If you happen to know more ways to take advantage of this handy procedure or better yet, improve it! Please, do share your valuable knowledge with your fellow Linux users
Without each others help there ain't no hope for us
Need a translation service? https://www.deepl.com/es/translator
Need a translation service? https://www.deepl.com/es/translator