O'Reilly logo

The Linux Command Line by William E. Shotts Jr.

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

Chapter 6. Redirection

In this lesson we are going to unleash what may be the coolest feature of the command line: I/O redirection. The I/O stands for input/output, and with this facility you can redirect the input and output of commands to and from files, as well as connect multiple commands to make powerful command pipelines. To show off this facility, we will introduce the following commands:

  • cat—Concatenate files.

  • sort—Sort lines of text.

  • uniq—Report or omit repeated lines.

  • wc—Print newline, word, and byte counts for each file.

  • grep—Print lines matching a pattern.

  • head—Output the first part of a file.

  • tail—Output the last part of a file.

  • tee—Read from standard input and write to standard output and files.

Standard Input, Output, and Error

Many of the ...

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