How to combine the output of multiple commands into a single file?
Answer:
You can combine multiple commands by a brackets, and do the file redirection.
E.g.
# (echo "A"; echo "B"; echo "C") > output.txt
Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.
How to combine the output of multiple commands into a single file?
Answer:
You can combine multiple commands by a brackets, and do the file redirection.
E.g.
# (echo "A"; echo "B"; echo "C") > output.txt
How to add line number to a text file?
Answer:
It is very easy with the nl command, when you want to add line number to a text file.
# nl file.txt
How to save a man page to a text file?
Answer:
To save a man page to a text file, you can use the following command:
# man ls| col -b > ls.txt
What filesystem(s) my Linux supports?
Answer:
E.g. To see what ext filesystems it support, use
# cat /proc/filesystems | grep ext
ext3
ext2
ext4
How to extract a particular file from a tar file?
Answer:
Assume you have a lot of files in a tar file, how do you extract only a particular file without extract all the files?
Just use the following command:
# tar xvf files.tar file.txt
Now only file.txt is extracted.