Monitoring Users

You can see who ’s logged in to the machine right now using the who command, as shown in Example 12-11.

Example 12-11. Using the who command

$ who
jldera   console  Jun 11 12:28
jldera   ttyp1    Jun 11 15:04
jldera   ttyp2    Jun 11 15:26
panic    ttyp3    Jun 11 15:27 (localhost)

The console entry is the GUI shell that you are logged into. The ttyp entries are created by active Terminal windows.

The w command outputs a different format of this information, as shown in Example 12-12.

Example 12-12. Using the w command

$ w
15:28  up  3:07, 4 users, load averages: 0.96 0.68 0.55
USER     TTY      FROM              LOGIN@  IDLE WHAT
jldera   console  -                12:28    2:59 -
jldera   p1       -                15:04       - w
jldera   p2       -                15:26       1 bash
panic    p3       localhost        15:27       - bash

As well as listing the users logged into the system, the w command gives the system uptime and load averages on the CPU.

You can see who has been logged into the system (as well as see when the system has been rebooted) by using the last command, as shown in Example 12-13.

Example 12-13. Using the last command

$ last
panic     ttyp3    localhost        Sat Jun 11 15:27   still logged in
jldera    ttyp2                     Sat Jun 11 15:26   still logged in
jldera    ttyp2                     Sat Jun 11 15:26 - 15:26  (00:00)
panic     console  ronin.local      Sat Jun 11 15:25   still logged in
jldera    ttyp1                     Sat Jun 11 15:04   still logged in
jldera    ttyp1                     Sat Jun 11 15:04 - 15:04  (00:00)
panic     console  ronin.local      Sat Jun 11 13:58 - 14:04  (00:06)
jldera    console  ronin.local      Sat Jun 11 12:28 - 13:58  (01:30)
reboot    ~                         Sat Jun 11 12:21

Get Running Mac OS X Tiger 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.