w
w linux command cheatsheet by Thamizhiniyan C S
Last updated
w linux command cheatsheet by Thamizhiniyan C S
Last updated
This command is used to show who is logged on and what they are doing.
w [options] [user]
Using the w
command without any additional options produces an output similar to this:
The first line of the output shows system information:
System time: The current system time.
Up time: How long the system has logged in.
Number of users: The number of users currently logged in.
Average system load: The average number of jobs running on the system in the last 1, 5, and 15 minutes, respectively.
The second line shows user and process information:
USER
: The names of currently logged in users.
TTY
: The name of the terminal the user is logging in from.
FROM
: The name or IP address of the terminal or host the user is logging in from.
LOGIN@
: The time the user logged in, in a 24-hour format.
IDLE
: The time since the user last used the terminal; displays ?xdm? if the user is currently active.
JCPU
: The total run time of all system processes attached to the user's terminal.
PCPU
: Elapsed time for the user's current process.
WHAT
: The name of the user's current process.
Flag | Description |
---|---|
Command | Description |
---|---|
-h, --no-header
Print output without the header.
-u, --no-current
Ignore username when calculating current process times and load.
-s, --short
Print output in the short format.
-f, --from
Toggle printing the FROM (remote hostname) field.
--help
Display help text.
-i, --ip-addr
Replace the hostname in the FROM field with the IP address.
-V, --version
Display current command version.
-o, --old-style
Print old-style output (blank space for idle times shorter than 1 minute).
Display the short format version of the w command output.
List the w command output without printing the header.
Ignore usernames when calculating current process and CPU times.
Check the current version of the w command.
Display the user's IP address in the FROM field.
Display the output in the old style, leaving blank spaces for short idle times.
Toggle the FROM field in the w command output.
Display the w command output for a specific user.
Display all the available options for the w command.