In general, you can think of each Unix command (ls, cd, and so on) as an individual program that Unix executes. For example, if you type cat /etc/mold at the prompt, Unix will display the contents of mold in the /etc directory. Each program requires input (in this example, cat, the program, takes the contents of /etc/mold as input) and produces output (i.e., the displayed results).
Frequently, you'll want to run programs in sequence. For example, you could tell Unix to read your resume and then spell-check it. In doing this, you connect two commands together and have them run in sequence. This process, in which you connect the output of one program to the input of another, is called piping. Depending on what you want to do, you can pipe together as many commands as you wantwith the output of each command acting as the input of the next.
As Figure 1.7 shows, you pipe commands together using the pipe symbol, which is the | character. In the following example, we'll pipe the output of the ls command (which lists the contents of a directory) to the more command (which lets you read results one screen at a time). For details about more, see Viewing File Contents with more, later in this chapter.
Figure 1.7. To execute multiple commands in sequence, pipe them together using the pipe symbol (|).
To Pipe Commands: