Example 3-3: Redirection Examples.
ls -al > file\_listing This example takes the output from the command "ls -al" and writes it to the file named "file_listing". The file named "file_listing" is either created as a new file, or the old file named "file_listing" is overwritten.
ls -al >> file\_listing In this case the file named "file_listing" is either created, or it is appended to. This means that if the file "file_listing" existed before, the new output from the command "ls -al" was added to it.
mail tim < report This example shows how easily a file named "report" can be mailed to another user (in this case named "tim") once it is created. Rather than type all of the desired information after entering the mail utility, you can create a file with a standard text editor, then mail it very quickly using file I/O redirection.
Next: Standard Error Symbols Up: Combining UNIX Commands Previous: Character Streams, Standard Input,   Contents |