Use who with the more or grep command to find out if a particular user is logged in.

On systems with many users, who may produce too much output to be easily scanned. You can pipe the who command through more if you want to be able to scan the output:

% who | more

You can also check to see if a particular user is logged in by piping the output through the grep command. For example, to find out if frank is logged in:

% who | grep frank
frank ttyq9 Sep 27 10:08  (ncd1.ora.com:0.0)
frank ttyqc Sep 27 10:08  (ncd1.ora.com:0.0)

Frank logged in at 10:08 this morning, with two terminal windows.

Remember to take this information with a grain of salt. For example, just because people are logged in to the computer doesn’t mean that they’re on the premises. I never log out, so someone typing who at 3:30 AM will see me logged in. Now, I may work hard upon occasion, but I’m not nuts.

Get WYNTK: UNIX System Admininistrator now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.