People often want to record the output of a program in order to process it. It is called "output redirection".
For example, if you want to record the output of the ls command in a "lsbin.txt" file (in your home directory), type:
ls /bin > ~/lsbin.txtIf the lsbin file already exists, its contents will be erased. To avoid this, type >> instead of > (this permits you to append the "ls" stream to the end of the lsbin.txt file)
Generally, the contents of a file or a directory scroll too rapidly on your screen and you do not have enough time to read them. A solution to this consists of saving the output of a command and then using the utility program "more" to read it ("more" is an editor which displays a text page after page).
So, you have to type:
ls /bin > ~/lsbin.txt
more ~/lsbinLinux proposes a more "elegant" method which consists of using pipes. With this method, the output of one command is sent to the input of another command. The result is:
ls /bin | moreHere, the output of the ls command is sent to "more" to be processed. You can combine different pipes to carry out complex procedures.