December 2012
Intermediate to advanced
888 pages
48h 24m
English
You can create, overwrite, and append data to files at the command line, using a process called input and output redirection. The shell recognizes several special characters for this process, such as >, <, or >>.
In this example, the output of the ls command is redirected to create a file named textfiles.listing:
matthew@seymour:~$ ls *.txt >textfiles.listing
Use output redirection with care because it is possible to overwrite existing files. For example, specifying a different directory but using the same output filename overwrites the existing textfiles.listing:
matthew@seymour:~$ ls /usr/share/doc/mutt-1.4/*.txt >textfiles.listing
Fortunately, most shells are smart enough to recognize when you might do something ...
Read now
Unlock full access