cheap nfl jerseys china cheap nfl jerseys free shipping wholesale nfl jerseys china wholesale jerseys from china cheap nfl jerseys free shipping cheap nfl jerseys for sale cheap jerseys free shipping wholesale nfl jerseys from china cheap nfl jerseys sale cheap nike nfl jerseys china wholesale jerseys free shipping cheap nfl jerseys wholesale wholesale nfl jerseys online cheap nfl jerseys wholesale china jerseys wholesale cheap coach handbags outlet authentic designer handbags cheap coach handbags outlet cheap coach purses outlet discount coach bags coach bags sale coach purse outlet cheap real coach purses coach handbags sale online coach purse outlet michael kors outlet online store cheap michael kors bags cheap michael kors purse michael kors factory outlet online cheap michael kors handbags cheap michael kors purses michael kors bags outlet online cheap michael kors purse michael kors handbags discount cheap michael kors purse michael kors handbags discount
cheap nfl jerseys china cheap nfl jerseys free shipping wholesale nfl jerseys china wholesale jerseys from china cheap nfl jerseys free shipping cheap nfl jerseys for sale cheap jerseys free shipping wholesale nfl jerseys from china cheap nfl jerseys sale cheap nike nfl jerseys china wholesale jerseys free shipping cheap nfl jerseys wholesale wholesale nfl jerseys online cheap nfl jerseys wholesale china jerseys wholesale cheap coach handbags outlet authentic designer handbags cheap coach handbags outlet cheap coach purses outlet discount coach bags coach bags sale coach purse outlet cheap real coach purses coach handbags sale online coach purse outlet michael kors outlet online store cheap michael kors bags cheap michael kors purse michael kors factory outlet online cheap michael kors handbags cheap michael kors purses michael kors bags outlet online cheap michael kors purse michael kors handbags discount cheap michael kors purse michael kors handbags discount
next up previous contents index
Next: Multitasking Up: The Standard Input and Previous: Input Redirection

Solution: The Pipe

 

Many Unix commands produce a large amount of information. For instance, it is not uncommon for a command like ls /usr/bin to produce more output than you can see on your screen. In order for you to be able to see all of the information that a command like ls /usr/bin, it's necessary to use another Unix command, called more .gif more will pause once every screenful of information. For instance, move < /etc/rc will display the file /etc/rc just like cat /etc/rc would, except that more will let you read it.gif

However, that doesn't help the problem that ls /usr/bin displays more information than you can see. more < ls /usr/bin won't work--input redirection only works with files, not commands! You could do this:

screen5734

However, Unix supplies a much cleaner way of doing that. You can just use the command ls /usr/bin | more. The character ``|'' indicates a pipe. Like a water pipe, a Unix pipe controls flow. Instead of water, we're controlling the flow of information!

A useful tool with pipes are programs called filters . A filter is a program that reads the standard input, changes it in some way, and outputs to standard output. more is a filter--it reads the data that it gets from standard input and displays it to standard output one screen at a time, letting you read the file.

Other filters include the programs cat , sort , head , and tail . For instance, if you wanted to read only the first ten lines of the output from ls, you could use ls /usr/bin | head.

 



Converted on:
Mon Apr 1 08:59:56 EST 1996