Enhancing Skills

who: Display who is currently logged in to the system

Command: who

The who command shows a list of users currently logged into the system. It provides information about the username, terminal, login time, and sometimes the originating IP address or hostname.


Sample Commands and Outputs:

  • who: Displays a list of users currently logged in. Sample Command and Output:
  $ who
  user1   tty1         2024-08-09 09:00
  user2   pts/0        2024-08-09 09:15 (:0)

Description:

  • user1: Username of the logged-in user.
  • tty1: Terminal on which the user is logged in.
  • 2024-08-09 09:00: The date and time when the user logged in.
  • who -a: Shows all available information including system boot time, run level changes, and user logins. Sample Command and Output:
  $ who -a
  system boot  2024-08-09 08:00
  run-level 3  2024-08-09 08:00
  user1   tty1         2024-08-09 09:00
  user2   pts/0        2024-08-09 09:15 (:0)

Description:

  • -a: Includes additional information such as system boot time and run level changes.
  • who -b: Displays the time of the last system boot. Sample Command and Output:
  $ who -b
  system boot  2024-08-09 08:00

Description:

  • -b: Shows the date and time of the last system boot.
  • who -H: Displays a header row with column names. Sample Command and Output:
  $ who -H
  NAME     LINE         TIME              COMMENT
  user1    tty1         2024-08-09 09:00
  user2    pts/0        2024-08-09 09:15 (:0)

Description:

  • -H: Includes a header row in the output.

Note: The who command is useful for monitoring active users on the system and can help in managing user sessions and system activity.


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.