users, who - Display who is logged in your system -
Follow @ggarronFor Desktop computers, this is usually needless, as you may be the only user logged in at an any given time, but if you are a server admin, you know that there may be a lot of users connected to the Server at a given time.
It is useful to know who they are, and maybe also, what are they doing, this for security reasons, but also if you are planning any server maintenance or reboot, you will have to know who are logged, and what are they doing to know if you can reboot the server in that moment, or have to wait.
users
Users is a very simple command that will list all users connected to the computer when it is run:
users
ggarron ggarron ggarron root root
You can see that ggarron and root appear more than once, this means that, those users are logged in, using differed terminal sessions.
who
This command gives some more information that the simple users, it also gives you from where the user is logged in.
who
ggarron tty1 Apr 25 10:01 root tty2 Apr 25 10:41 ggarron tty3 Apr 25 10:41 ggarron pts/0 Apr 25 10:09 (:0.0) root pts/1 Apr 25 10:42 (force.alketech.com)
And also the time when that users logged into the server.
There are some other usages.
who -b
Prints the time of last system boot
who -Hu
NAME LINE TIME IDLE PID COMMENT ggarron tty1 Apr 25 10:01 00:46 5354 root tty2 Apr 25 10:41 00:08 5355 ggarron tty3 Apr 25 10:41 00:07 5358 ggarron pts/0 Apr 25 10:09 00:03 5660 (:0.0) root pts/1 Apr 25 10:42 00:07 5974 (force.alketech.com) ggarron pts/2 Apr 25 10:46 . 6011 (:0.0)
Prints more info about logged users than using it with no options.
w
w is like a complement to who as it displays logged users, but also what are they doing in that moment.
w
10:53:38 up 52 min, 6 users, load average: 0.08, 0.05, 0.01 USER TTY LOGIN@ IDLE JCPU PCPU WHAT ggarron tty1 10:01 50:14 1:23 0.00s /bin/sh /usr/bin/startx root tty2 10:41 11:34 0.00s 0.00s -bash ggarron tty3 10:41 11:01 0.02s 0.02s ssh force.alketech.com ggarron pts/0 10:09 1:17 0.00s 0.00s man w root pts/1 10:42 11:01 0.00s 0.00s -bash ggarron pts/2 10:46 0.00s 0.00s 0.00s w