w
w linux command cheatsheet by Thamizhiniyan C S
Introduction
This command is used to show who is logged on and what they are doing.
Syntax
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.
Important Flags
Flag | Description |
---|---|
| Print output without the header. |
| Ignore username when calculating current process times and load. |
| Print output in the short format. |
| Toggle printing the FROM (remote hostname) field. |
| Display help text. |
| Replace the hostname in the FROM field with the IP address. |
| Display current command version. |
| Print old-style output (blank space for idle times shorter than 1 minute). |
Examples
Command | Description |
---|---|
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. |
Last updated