Redirecting Input and Output

There are times when you’d like to save the output from a command instead of just having it displayed on the monitor. The shell provides a few different operators that allow you to redirect the output of a command to an alternative location (such as a file). Redirection can be used for input as well as output, redirecting a file to a command for input. This section describes what you need to use redirection in the CLI.

Output Redirection

The most basic type of redirection is sending output from a command to a file; this is called output redirection. Bash uses the greater-than symbol for this:

Command space greater than space output file.

Anything that would ...

Get Linux Fundamentals, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.