This article explains how to utilise a variety of commands that show details like usernames, login times, and terminal sessions to examine all users who are currently logged in on Linux.
Follow the guide:
- Using the ‘who’ Command:
This command displays all active sessions:who
It lists logged-in users, their terminals, login time, and remote IP (if any).
- Using the ‘w’ Command
This command offers more detailed information:w
It displays the load average, system uptime, and the users’ logged-in identities and active processes.
- Using the ‘users’ Command
The user’s command gives a simple list of logged-in usernames:users
- Using the ‘last’ Command
The last command displays a history of user logins (not just current ones):last
To see only currently logged-in users, pair it with ‘grep’:
last -a | grep still
- As a best practice, use ‘who’ or ‘w’ for real-time login information, and ‘last’ to review historical login sessions.
In conclusion, these commands allow you to easily monitor and track all users currently logged into your Linux system.
Gain full control over users and sessions with a Linux VPS environment.
Want deeper insights into activity? Learn How to install and use the query monitor plugin