Redirecting standard output

To redirect the standard output from a command use the > (greater than) symbol followed by the name of the output file. If the file that you redirect standard output to does not already exist it will be created. For example:

   grep Smith /etc/passwd > popular

This redirects the standard output from the grep command so that it goes to the file popular. This file will contain all occurrences of the string Smith that were found in the /etc/passwd file.


[Home] [Search] [Index] This site maintained by webmaster@deslab.mit.edu