When you run this command, you can find out who are currently logged on to the system and the programs they are running.
If you run the w command separately, all users are displayed. You can also specify the user name to only display information about a user.
Syntax
W [-fhlsuV] [user name]
Parameter description:
- -F. Enable or disable the function to show where the user logs on to the system.
- -H: the title information column of each column is not displayed.
- -L use the detailed format list, which is the default value.
- -S uses a concise format list, which does not display the user logon time, CPU time consumed by terminal jobs and programs.
- -U ignores the name of the execution program and the CPU time consumed by the program.
- -V displays the version information.
Instance
Show current user
W // display the current user, not the logon location
19:50:14 up, 4 users, load average: 0.31, 0.26, 0.18
User tty from login @ IDLE JCPU PCPU WHAT
Root tty7: 0 Thu12 31: 39 m 10:10 0.60 s gnome-session
Root pts/0: 0.0 2: 18 m 15.26 s 0.15 s bash
Root pts/1 192.168.1.17 1.00 s 1.24 s 0.14 s-bash
Root pts/2 192.168.1.17 60.00 s 0.05 s 0.05 s-bash
Logon location not displayed
W-f
19:53:59 up, 4 users, load average: 0.05, 0.16, 0.15
User tty login @ IDLE JCPU PCPU WHAT
Root tty7 Thu12 31: 43 m 10:10 0.60 s gnome-session
Root pts/0 2: 21 m 15.26 s 0.15 s bash
Root pts/1 0.00 s 1.04 s 0.14 s-bash
Root pts/2 0.05 s 0.05 s-bash
Display in simplified mode
W-s
19:54:37 up, 4 users, load average: 0.24, 0.19, 0.16
USER TTY FROM IDLE WHAT
Root tty7: 0 31: 43 m gnome-session
Root pts/0: 0.0 2: 22 m bash
Root pts/1 192.168.1.17 0.00 s-bash
Root pts/2 192.168.1.17 5:23-bash
Do not show title
W-h
Root tty7: 0 Thu12 31: 44 m 0.60 s gnome-session
Root pts/0: 0.0 2: 23 m 15.26 s 0.15 s bash
Root pts/1 192.168.1.17 0.00 s 1.05 s 0.14 s-bash
Root pts/2 192.168.1.17 0.05 s 0.05 s-bash