As an administrator you always have to check who is logged in on your system and this is compulsory when you have a team in which various people are working. If you are the admin and you have to monitor all the team members work then this article is very helpful for you. Now the question arise how you can check the logged in users.
There are various commands to check the logged in users in Linux. In this article we are going to explain the commands through which you can check the current user logged-in on Linux.
1. who command : who command can check the information of current user like username, tty number, host number, date & time.
And output will be like this :
2. whoami command : this command shows username which is related to effective user id.
3. W command : this command shows all the information related to current user and their processes. W command has the various values like tty number, username, remote host, idle time, user’s login time, PCPU (time used by the current process), JCPU(time used by all processes attached to the tty) and what command user performing currently.
After this command you will get the following result :
4. Users command : This command only print the user name who is currently logged in. If you need to check only user name then you can use this command :
5. Last command : If you need to check the list of last logged in users, then you can use this command. In this command following details included like login user name, remote host, tty number, login time, logout time, date and total duration (working time).
There are various commands to check the logged in users in Linux. In this article we are going to explain the commands through which you can check the current user logged-in on Linux.
1. who command : who command can check the information of current user like username, tty number, host number, date & time.
Code:
# who
Code:
root pts/0 2017-05-31 15:22 (203.99.204.108)
Code:
# whoami
Code:
# w
Code:
17:13:34 up 1:52, 1 user, load average: 0.11, 0.18, 0.15
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/0 203.99.204.108 15:22 6.00s 0.18s 0.00s w/
Code:
# users
Code:
Root
Code:
# last
Code:
root pts/0 203.99.204.108 Wed May 31 15:22 still logged in
reboot system boot 3.5.0-54-generic Wed May 31 15:20 - 17:57 (02:37)