Ad Code

3.4 Pipes

To see who is on the system with you, type

% who

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

% who > names.txt
% sort <>

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

% who sort

will give the same result as above, but quicker and cleaner.

To find out how many users are logged on, type

% who wc -l

Post a Comment