O'Reilly logo

Ubuntu Unleashed 2014 Edition: Covering 13.10 and 14.04,Ninth Edition by Paul Hudson, Andrew Hudson, Matthew Helmke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Piping Data

Many Linux commands can be used in concert in a single, connected command line to transform data from one form to another. Stringing Linux commands together in this fashion is known as using or creating pipes. Pipes are created on the command line with the bar operator (|). For example, you can use a pipe to perform a complex task from a single command line like this:

matthew@seymour:~$ find /d2 -name '*.txt' -print | xargs cat | \tr ' ' '\n' |  sort | uniq >output.txt

This example takes the output of the find command to feed the cat command (via xargs) the name of all text files in the /d2 directory. The content of all matching files is then fed through the tr command to change each space in the data ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required