>     >>     |    

Redirecting output

Any program or command that produces textual output to the screen (called standard output) can be simply directed to put that text into a file instead of onto the screen. Or, using the character ``|'', it can be passed directly to another command.


>
Use the character `>' (``right arrow'', or ``right angle bracket'', or ``greater than'') followed by a filename, after a command to create a new file with the results of the command. Example:

WARNING: If file bbb already exists, and you command   myprog > bbb,   then the old file bbb will be deleted and replaced by the output of the command `myprog'.

>>
If you want to append text output to an existing file -- without destroying its existing contents! -- then use double arrows, >>. Examples:


|
Using |, the output from a command can be piped directly into another command. Examples: