Command Line Basics: Pipelining Output

September 5, 2009 by
Filed under: bash, command line, HowTo, linux, Ubuntu 

One of the most powerful features of the Linux command line interface, (and other shells that conform to the POSIX standard) is the ability to pipeline output from one command as the input to another. This is done using the vertical bar or pipe character [ | ].

For an example, I'll show something fairly useless. You probably know that the ls command will list the files in a directory. I've also covered the use of the echo command. The output of the command echo ls is simply ls.

echo ls


So if we pipe this output into a new bash shell, we should get the normal output of the ls command.

Affiliate Link
echo ls | bash

Like I said, this is a fairly simple and useless example, but I'll show more advanced uses of this in later posts. I've also used pipelining in some bash scripts like my script to Batch Watermark Images with ImageMagick.


3 Responses to “Command Line Basics: Pipelining Output”

  1. swantron says:

    Excellent tux tweak.

  2. [...] Command Line Basics: Pipelining Output [...]

  3. Story added...

    This story has been submitted to! If you think this story should be read by the free software community, come vote it up and discuss it here:

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>