In Ubuntu, you can check the current users using different methods. It is important to know who is currently logged in to your system, especially when you are working in a multi-user environment or managing a server.
In this short guide, we will go through the steps to check current users in Ubuntu using the “who” and “w” commands.
Step 1: Check Current Users Using the “who” Command
The “who” command displays the list of all currently logged in users on the system. To use this command, open a terminal and type the following command:
who
The output will display a list of currently logged in users, including their username, terminal, and login time.
nick pts/1 2023-04-24 15:27 (45.131.193.38) dmitry pts/2 2023-04-24 15:57 (45.131.193.38)
Step 2: Check Current Users Using the “w” Command
The “w” command displays a more detailed output of the currently logged in users, including their username, terminal, login time, idle time, and process information. To use this command, open a terminal and type the following command:
w
The output will display the information about the currently logged in users in a table format.
16:36:04 up 7:25, 2 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT nick pts/1 45.131.193.38 15:27 1:03m 0.02s 0.02s -bash dmitry pts/2 45.131.193.38 15:57 0.00s 0.03s 0.00s w
Step 3: Check Current User’s Information Using the “whoami” Command
The “whoami” command displays the current user’s username. To use this command, open a terminal and type the following command:
whoami
The output will display the username of the current user.
dmitry
Commands Mentioned:
- who – a command that displays the list of all currently logged in users on the system.
- w – a command that displays a more detailed output of the currently logged in users.
- whoami – a command that displays the current user’s username.
Conclusion:
In this guide, we have outlined the steps to check the current users in Ubuntu using the “who”, “w”, and “whoami” commands. By using these commands, you can easily obtain the necessary information about the current users on your system. If you have any questions or suggestions, feel free to comment below.