It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In RegisterIt looks like you're new here. If you want to get involved, click one of these buttons!
As a Linux system administrator, you should check the login date and time of your server's users on a regular basis. It provides you with information such as how many users are active, how many users are inactive, when and for how long they log in, and so on.
In Linux operating systems, there is w command that helps you to find who is logged on and what they are doing in the system. This is the most commonly used command-line tool to display the information about the users currently on the server and their processes.
The w command shows various useful details including the following:
The command output example:
As you can see in the above output, currently there are two users (root and test) logged into Ubuntu server. The w command displays the following details for the individual users:
If you want to display the details of a specific logged in user, or example, test, the command would be:
w test
The who command is another command that displays information about users who are currently logged in a Linux machine.
The command output example:
2.1 You can filter details for a specific user with grep command:
who | grep ostechnix
2.2 If you want to display information only for the current terminal session, run:
who am i
2.3 You can display all available information of current logins using -a flag:
who -a
The users command prints the user names of users currently logged in to the current host system.
The last command usually displays all the users that have ever logged in and out of a Linux machine since the /var/log/wtmp file was created.
There are various commands that you can use to find the last logged in users in your VPS, so feel free to use our provided commands in this guide or other commands that you can ins on the internet.