->Title Page
->Intro
->Unix
-->Overview
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
-->Login files
-->Special characters
--->Wildcards
->Redirection
--->Pipes
--->Quote characters
--->Others
-->Miscellaneous Tips
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

Unix ---> Redirecting input and output

A program that normally reads its input from the terminal (standard input) or normally writes its output to the terminal (standard output) may become annoying if you would rather send the input from a file instead of the keyboard or send the output to a file instead of the terminal. This annoyance can be avoided if you happen to be swift with the redirection operators. The redirection operators are "<", ">", and ">>". The first is used to send input to a command. The second is used to create a file and send the output to it. The third is used to append the output to an existing file.

An example of the first redirection operator was already given in the Electronic Mail section. Suppose you wanted to put a list of all the people logged on into a file called neatguys with the current time listed at the top of the file.


    date > neatguys
would create a file with the date and time in it, and


    who >> neatguys
would append the list of users logged on.

Site Statistics

Find this site useful? Want to give something back?

t a y l o r@l i n u x a v e.n e t

© 1993-2000 Christopher C. Taylor