who

who: The who command in Linux displays information about users currently logged into the system. It shows details such as the username, terminal, login time, and, sometimes, the IP address or hostname from which the user is connected.

Basic Usage:

  • who: Displays a list of users currently logged in, along with their login details.

Example Output:

who
# Output:
# user1    tty7         2024-08-19 10:23 (:0)
# user2    pts/1        2024-08-19 11:45 (192.168.1.100)

In this example:

  • user1 is logged in locally via the graphical interface (shown as tty7), logged in at 10:23.
  • user2 is logged in remotely via a terminal session (shown as pts/1), logged in at 11:45 from the IP address 192.168.1.100.

Common Options:

  • who -a: Displays more detailed information, including system boot time, run-level, and dead processes.
  • who -b: Shows the last system boot time.
  • who -q: Displays only the usernames of the logged-in users and the number of users logged in.

Example with Options:

who -b
# Output:
# system boot  2024-08-19 09:15

This command shows that the system last booted on August 19, 2024, at 09:15.

The who command is particularly useful for system administrators to monitor user activity and see who is currently using the system.

Leave a Reply

Your email address will not be published. Required fields are marked *