Pipes

To see who is on the system with you, type

$HOME $> who

One method to get a sorted list of names is to type,

$HOME $> who > names.txt
$HOME $> sort < names.txt

This is a bit slow and you have to remember to remove the temporary file called names when you have finished. What you really want to do is connect the output of the who command directly to the input of the sort command. This is exactly what pipes do. The symbol for a pipe is the vertical bar  

For example, typing

$HOME $> who | sort

will give the same result as above, but quicker and cleaner. To find out how many users are logged on, type

$HOME $> who | wc -l

Supported By

File Browser Reference
Department FHERIS
University of Galway
HEA Logo