Specifications

Redirecting Input and Output
From the command line, you can redirect input and output from a command to a le,
or to another command.
Redirect output from the command if you want to capture the results of running the
command and store it in a le for later use. Similarly, redirect input from a le to the
command if you want to provide the command with preset input data, instead of
needing to enter that data.
Use the following characters to redirect input and output:
Redirect Description
> Use a right angle bracket to redirect command
output to a le.
< Use a left angle bracket to use the contents of
a le as input to the command.
>> Use two right angle brackets to append output
from a command to a le.
In addition to using le redirection, you can also redirect the output of one command
to the input of another using the vertical bar character, or pipe. You can combine
commands in this manner to implement more sophisticated versions of the same
commands.
For example, the command man bash | grep commands passes the formatted
contents of the bash man page to the grep tool, which searches those contents for
lines containing the word commands.” The result is a list of lines with the specied
text, instead of the entire man page.
For more information about redirection, see the bash man page.
Correcting Typing Errors
You can use the Left and Right Arrow keys to correct typing errors before you press
Return to execute a command.
To correct a typing error:
1 Press the Left or Right Arrow key to skip backward or forward over parts of the
command you don’t want to change.
2 Press Delete to remove characters.
3 Type regular characters to insert them.
4 Press Return to execute the command.
To ignore what you entered and start again, press Control-U.
20 Chapter 2 Using the Command-Line Shell Interactively