| You are here: SillyDog701 > UNIX Guide >SillyDog701 > UNIX Guide > Command > |
To pipe the output from one command into another command:
who | wc -l 342
This command tells you how many users are currently logged in on the system: a lot!
The standard output from the who command - a list of all the users currently logged in on the system - is piped into the wc command as its standard input. Used with the -l option this command counts the numbers of lines in the standard input and displays the result on the standard output.
To connect several commands together:
ps -aux|grep joe|sort +5 -6|less
The first command ps -aux outputs information about the processes currently running. This information becomes the input to the command grep joe which searches for any lines that contain the username "joe". The output from this command is then sorted on the sixth field of each line, with the output being displayed one screenful at a time using the less pager.
UNIX Guide home |
search |
index
| Page URL: http://sillydog.org/unix/ [SillyDog701] [Netscape] [MozInfo701] [MacCentre701] [UNIX Guide] [AntTunes701][Forums] [Search] [Change Log] [Feedback] [About Us] [Sitemap] This UNIX Guide maintained by SillyDog701, portion of this Guide is based on UNIXhelp. UNIXhelp is copyright University of Edinburgh. This page was last modified on 14 March, 2006 |
support MozInfo701 and SillyDog701 |