Combining Commands Pipes

Pipes are a way to link programs together. The first program's standard output is redirected to the second program as standard input. The chain can continue for as many programs as you like. The pipe operator is a vertical bar (|), so a piped series of commands looks like this:

This example takes the output of ps ax and pipes it into grep, which searches for lines containing the string gdm. Using grep in this way can be a good way to trim a verbose program's output down to size. You may also want to pipe textual output through the less pager, enabling you to peruse the output at a human pace.

0 0

Post a comment