A Quick Guide to UNIX Pipes

Programs have three standard I/O streams, called standard input (input to the program), standard output (output from the program), and standard error (error messages). Usually they all connect to the terminal:

     +----------+
     | Terminal |
     +----------+             
          | 
          | stdin
          V                     
     +---------+ 
     | Program |                
     +---------+ 
       |    |           
stdout |    | stderr
       |    | 
       V    V    
     +----------+                
     | Terminal |    
     +----------+    

However, you can subvert them, by taking/sending them from/to other programs (this is called piping) or files:

     +----------+
     | Terminal |
     +----------+             
          |      
          | stdin
          V                     
     +-----------+       
     | Program A |-------+      
     +-----------+       |
stdout |                 |           
 of A  |                 | stderr 
       | stdin           |           
       V  of B           |           
     +-----------+       |
     | Program B |-------+      
     +-----------+       |         
       |                 |         
stdout |                 |         
       |                 |         
       V                 V         
     +----------+      +----------+ 
     | File     |      | Terminal |
     +----------+      +----------+             

This would be "progA | progB > file". Just the output of progB ends up in the file. Any error messages come straight to the terminal where you can see them.

XFree86 puts its help text on stderr rather than stdout, which is why it'll escape if you try to just pipe it to more.

The above description was taken from a posting to the Wolverhapton Linux User Group mailing list. People seemed to think it was particularly helpful, so I thought I'd put it here where Google would find it.

home