This post is older than a year. Consider some information might not be accurate anymore.
top
gives you information about active users on a linux server system.
Example
top - 13:13:29 up 167 days, 21:45, 5 users, load average: 3.98, 4.28, 4.05
Threads: 40110 total, 4 running, 40104 sleeping, 0 stopped, 2 zombie
%Cpu(s): 3.7 us, 1.6 sy, 0.1 ni, 94.4 id, 0.0 wa, 0.0 hi, 0.1 si, 0.0 st
KiB Mem : 13112041+total, 8070096 free, 64865496 used, 58184820 buff/cache
KiB Swap: 4194300 total, 4139660 free, 54640 used. 65108580 avail Mem
Above information has a total of 5 users.
The command w
displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.
Example: Another user has logged in.
lemapper@theta:~/> w
13:15:10 up 167 days, 21:46, 6 users, load average: 4.55, 4.23, 4.04
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
user1 pts/0 10.16.29.65 11:02 2:10m 0.04s 0.01s sshd: user1 [priv]
tan pts/3 10.51.192.109 08:56 6.00s 0.25s 0.02s sshd: tan [priv]
user3 pts/8 10.51.192.176 Fri11 4days 0.79s 0.00s sshd: user3 [priv]
user6 pts/9 10.43.19.69 11:55 1:16m 0.07s 0.02s sshd: user6 [priv]
user4 pts/15 10.43.18.176 13:13 54.00s 0.08s 0.01s sshd: user4 [priv]
user5 pts/17 10.51.193.125 12:53 18:06 0.08s 0.01s sshd: user5 [priv]
Check only for specific user
lemapper@theta:~/> w tknga
13:15:22 up 167 days, 21:47, 6 users, load average: 5.95, 4.53, 4.14
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
tan pts/3 10.51.192.109 08:56 2.00s 0.28s 0.02s sshd: tan [priv]
Users gives alphabetically sorted list
lemapper@theta:~/> users
tan user1 user3 user4 user5 user6