All computers need a method for accepting and displaying information. The method of accepting information is called standard input (usually the keyboard) and the method of displaying information is called standard output (usually the monitor).

All commands follow this principle, having a standard input and output. Input is defined as sending data into a command. Output is defined as receiving data from a command.

Standard Input > Command > Standard output

In the Linux environment you can change the input or output by redirecting it to another device. The left angle bracket (<) symbol, for instance, is used to redirect the standard input of a command from a file instead of from the keyboard.

The following example shows how to send someone a file from the command line using the standard input redirection with the mail program (used for sending e-mail). The example takes the information from the file chuck and sends it to the user marcy@omnilinux.com

$ mail -s "subject" marcy@omnilunux.com < chuck
$

The window or terminal is known as a command's standard output. To redirect the output of a command to a file instead of a screen, use the right-angle bracket (>)

$ cat chuck > chuck_7
$ ls -l > chuck_7
$

Tip: If the file name already exists, you will automatically overwrite it when using the right angle bracket. To avoid accidentally overwriting files, add the following variable to your .bashrc file: set -o noclobber. If you are using the Bash shell, add the following variable to your .bashrc file: set nocobbler