Linux who command

Apologies for the repeated response. Here is the correct answer:

The “who” command in Linux is used to display information about currently logged-in users. It provides details such as the username, terminal or remote connection, login time, and IP address (if applicable) of each logged-in user.

Here is the basic syntax of the “who” command:

who [options]

Here’s a practical example of how to use the “who” command:

  1. Display information about currently logged-in users:
   who

Running the “who” command without any options will display a list of currently logged-in users, including their usernames, terminals or remote connections, login dates and times, and IP addresses (if applicable).

Example:

   $ who
   john     tty1         May 22 18:12
   jane     pts/0        May 21 09:28 (:0.0)

In this example, the “who” command displays information about the currently logged-in users “john” and “jane”, including their login terminals and dates/times.

  1. Display information about only the username and terminal:
   who -q

Adding the “-q” option to the “who” command will display a summarized output, showing only the username and terminal information of logged-in users.

Example:

   $ who -q
   john     tty1
   jane     pts/0

In this example, the “who” command with the “-q” option provides a condensed output, listing only the usernames and terminals of the logged-in users.

The “who” command is useful for checking which users are currently logged in to the system, identifying their terminals or remote connections, and verifying login times. It can be helpful for system administrators or users who need to monitor user sessions or determine who is actively using the system at a given time.