The who command is an essential tool for displaying the users logged in to the Linux system. Whether you are using a personal computer or a server with multiple users, this command provides valuable information about active sessions.

In most cases, as a single user on a personal computer, you will likely be the only one logged in. However, if you have opened multiple shells or terminal windows, each instance will be counted as a separate access, and who will display these details accordingly.

Here is an example output of the who command:

$ who
username   pts/0        2020-09-03 18:03 (192.168.0.1)
username   pts/1        2020-09-03 18:04 (192.168.0.1)

The displayed information includes the username, the terminal name (pts/0 and pts/1 in this case), and the date and time when the session started.

To obtain more detailed information, you can use the -aH flags with the who command. This will include additional details such as idle time and the process ID (PID) of the terminal:

$ who -aH
username   pts/0        2020-09-03 18:03   still logged in   12345
username   pts/1        2020-09-03 18:04   00:05             23456

Here, the output tells us that the first user (pts/0) is still logged in, while the second user (pts/1) has been idle for 5 minutes.

Additionally, you can use the special who am i command to retrieve details about the current terminal session:

$ who am i
username   pts/0        2020-09-03 18:03 (192.168.0.1)

The output provides the same information as the regular who command but is specifically limited to the current user.

It’s important to note that the who command is not limited to Linux systems. It works seamlessly on macOS, Windows Subsystem for Linux (WSL), and any UNIX-based environment. So, regardless of your setup, you can rely on who to keep track of the logged-in users.