UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 51.3 ASCII Characters: Listing and Getting Values Chapter 51
Miscellaneous Useful Programs and Curiosities
Next: 51.5 Copy What You Do with script
 

51.4 Who's On?

The who command lists the users logged on to the system now. Here's an example of the output on my system:

% who
naylor   ttyZ1   Nov  6 08:25
hal      ttyp0   Oct 20 16:04   (zebra.ora.com:0.)
pmui     ttyp1   Nov  4 17:21   (dud.ora.com:0.0)
jpeek    ttyp2   Nov  5 23:08   (jpeek.com)
hal      ttyp3   Oct 28 15:43   (zebra.ora.com:0.)
    ...

Each line shows a different terminal or window. The columns show the username logged on, the tty (3.8) number, the login time, and, if the user is coming in via a network (1.33), you'll see (in parentheses) their location. The user hal is logged on twice, for instance.

It's handy to search the output of who with grep (27.1)- especially on systems with a lot of users. For example:


-v 
% who | grep "^hal "             ...where is hal logged on?
% who | grep "Nov  6"            ...who logged on today?
% who | grep -v "Nov  6"         ...who logged on before today?
    ...

who
The GNU who, on the CD-ROM, has more features than some other versions.

- JP


Previous: 51.3 ASCII Characters: Listing and Getting Values UNIX Power ToolsNext: 51.5 Copy What You Do with script
51.3 ASCII Characters: Listing and Getting Values Book Index51.5 Copy What You Do with script

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System