Three Ways To See Who Is Logged Into A Linux Computer

If you are a linux system administrator you may want to know who else is logged into a server you are on. You may also want to know exactly what they are doing. These three linux commands show you what users are currently logged into a server.

users

The users command is the most simple. It just provides a list of users who are currently logged in. It does not give you any more information. You cannot find out what the user is going or how long they have been logged in.

$ users josh

who

The who command lists all the users currently logged into a linux server along with the date and time of the login and the IP address where they have logged in from.

$ who josh pts/0 2016-05-07 14:01 (2001:470:0:19:183f:5a6f:fc3e:66c7)

w

The w command (that's right, it's just the letter w) shows the most details. It shows what the above commands show, plus it shows what that user is currently doing. It also include server specific information, wish as the load average and the uptime of the server. A very useful command.

$ w 19:21:45 up 22 days, 1:52, 1 user, load average: 0.00, 0.00, 0.00 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT josh pts/0 2001:470:0:19:18 14:01 1.00s 0.10s 0.00s w

If you currently use the users or who command, you should consider using the w command instead. It shows what the other two commands show, plus more information.