Ubuntu is designed to support multiple users. The administrator has the specific commands and utility tools to check which users are currently logged in to the server. Ubuntu is widely used as a server and the need for checking logged-in users is crucial. Administrators can check for unauthorized access to the systems, manage user permissions, and troubleshoot problems while checking the logged-in users.
This article elaborates on multiple methods used to check the currently logged-in Users in Ubuntu.
How to see Logged-In Users in Linux/Ubuntu?
In Ubuntu, different approaches can be followed to list logged-in users. All the methods that can be used to display the currently logged-in users are:
- Using “users” Command
- Using “w” Command
- Using “who” Command
- Using “ps au” Command
- Using Finger Utility Tool
All the methods are discussed in detail below.
Method 1: See Logged-In Users using the “users” command
The “users” command lists the currently logged-in users in Ubuntu. It only displays the names of the logged-in users. Use the “users” command as:
The logged-in users will be listed in the terminal:
Method 2: See Logged-In Users using the “w” command
The “w” command is the fastest way to check users currently logged in to Ubuntu and monitor their activity. To display logged-in users with “w”, use the command:
The “w” command will display the name of the currently logged-in user, the “tty” number which is the user machine Number, the User’s Login Time, Recent Command Executed by the User, and some other columns:
Method 3: See Logged-In Users using the “who” command
The “who” command will list the username of users currently logged in to Ubuntu. Use the “who” command with the flag:
The “-H” flag enhances reliability and shows the Headers. It will display the logged-in user name, the Machine Number, and the Log In Time:
Method 4: See Logged-In Users using the “Finger Utility Tool”
The “Finger Utility Tool” is an interface that displays the current users logged in to Ubuntu. The finger utility has to be installed first as it is not added by default. Install the Finger Utility using the command:
When installed, display the information using the “finger” command:
The “idle” displays if the user is idle and for how much time:
Method 5: See Logged-In Users using the “ps au” command
To list the logged-in users, the “pu au” Command can also be used. The “ps au” command displays the users who are logged in to Ubuntu and monitors the applications they are running. The “pu au” command in Ubuntu is used as:
It will display the User Name, the Process ID of any processes run by the user, the Commands used by the user, the Machine Number, the start time of the process, and some other options:
Conclusion
The Command Line Interface is used for displaying the currently logged-in users by Administrators as it is more flexible and reliable. The logged-in users can be displayed using any of the “user”, “who”, “w”, “ps au” Commands, or the Finger Utility Tool. This article explains the methods to see logged-in users in Ubuntu.