w command

LINUX-Frequently used commands

w command Show user information while logged in.
Syntax
w   [Option]
The w command displays the logged-in user information like the who command, but with more detail than the who command.
In addition to the information displayed by the who command, the following information will be displayed.
・System information(Hours of operation, number of logged in users, load)
・IDEL Time(Time not in operation)
・JCPU (The amount of time the terminal has used the CPU)
・PCPU (The amount of time the processes listed in WHAT used the CPU)
・WHAT (The process the user is running)
Frequently used options
-h   Hide header
-s   Shorten the display. Do not show login time, JCPU, PCPU
-f    Hide FROM (remote hostname) (depends on distribution)
Example: No options.
$ w
12:25:45  up 7 days, 21:47, 2 users, load average: 0.00, 0.01, 0.05
USER        TTY     FROM                      LOGIN@    IDLE      JCPU    PCPU   WHAT
root          pts/0   xxxyyyzzz.abcdefg     11:54      18:41     0.04s   0.04s  -bash
koro         pts/1    xxxyyyzzz.abcdefg     12:08      1.00s     0.08s   0.00s  w
Example: Run a command with a user name.
$ w  koro
12:25:45  up 7 days, 21:47, 2 users, load average: 0.00, 0.01, 0.05
USER        TTY     FROM                      LOGIN@    IDLE      JCPU    PCPU   WHAT
koro         pts/1    xxxyyyzzz.abcdefg     12:08      1.00s     0.08s   0.00s  w
Example: Hide header.
$ w  -h
USER        TTY     FROM                      LOGIN@    IDLE      JCPU    PCPU   WHAT
root          pts/0   xxxyyyzzz.abcdefg     11:54      18:41     0.04s   0.04s  -bash
koro         pts/1    xxxyyyzzz.abcdefg     12:08      1.00s     0.08s   0.00s  w
タイトルとURLをコピーしました