Linux Tutorials - Herong's Tutorial Examples - v5.45, by Herong Yang
"who | w" - Logged-in Users and Their Running Commands
This section provides a tutorial example on how to display logged-in users and their running commands using 'who' and 'w' commands on Linux systems.
If the system shared with other users, you may want to know who else are logged in to the system at this moment using the "who" command. Here is an examples of "who" command output on my CentOS computer:
herong$ who -H NAME LINE TIME COMMENT herong pts/0 2024-08-10 20:02 (192.168.5.1) john pts/1 2018-03-16 19:27 (192.168.5.9)
You can also add the "-a" option to print out moer information:
herong$ who -H -a NAME LINE TIME IDLE PID COMMENT EXIT system boot 2024-03-04 22:56 run-level 3 2024-03-04 14:56 LOGIN ttyS0 2024-03-04 14:56 1350 id=tyS0 LOGIN tty1 2024-03-04 14:56 1349 id=tty1 herong + pts/0 2024-08-10 20:02 . 5459 (192.168.5.1) pts/1 2024-08-08 12:37 5187 id=ts/1 term=0 exit=0 pts/2 2024-07-08 11:56 9630 id=ts/2 term=0 exit=0 ...
Note that the "-a" option is a combination of "-b -d -l -p -r -t -T -u" options, which are described below:
-b time of last system boot -d print dead processes -l print system login processes -p print active processes spawned by init -r print current runlevel -t print last system clock change -T add user's message status as +, - or ? -u list users logged in
If you want to see what commands are loggin-in user running, you can use the "w" command:
herong$ w 20:48:49 up 159 days, 5:52, 1 user, load average: 0.04, 0.05, 0.02 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT herong pts/0 192.168.5.1 20:02 1.00s 0.01s 0.00s top
Table of Contents
►Introduction to Linux Systems
"uname" - Display System Information
"free" - Display Free and Used Memory
►"who | w" - Logged-in Users and Their Running Commands
Cockpit - Web Portal for Administrator
SELinux - Security-Enhanced Linux
SSH Protocol and ssh/scp Commands
Software Package Manager on CentOS - DNF and YUM
vsftpd - Very Secure FTP Daemon