In this article we will talk about commands
w (Command w).
w is a command line utility that displays information about currently registered users and what each user is doing. It also provides information about system operation time, current time and Average load the system.
How to use the w command
The syntax of the w command is as follows:
w [OPTIONS] [USER]
When w is called without any options or arguments, the result looks like this:
21:41:07 up 12 days, 10:08, 2 users, load average: 0.28, 0.20, 0.10 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT root pts/0 10.10.20.2 20:59 1.00s 0.02s 0.00s w linuxid pts/1 10.10.10.8 21:41 7.00s 0.00s 0.00s bash
The first line provides the same information as the command
uptime . It contains the following columns:
21:41:07Current system time.
up 12 days, 10:08– The length of the system operation period.
2 users– The number of registered users.
load average: 0.28, 0.20, 0.10System load averages during the last 1, 5 and 15 minutes. Average system load is a measure of the number of jobs currently running or awaiting disk I / O. It basically tells you how busy your system is during the specified period of time.
The second line includes the following fields:
USER– Enter the username.
TTY– The name of the device used by the user.
FROM– The hostname or the IP address that the user is logging in from.
[email protected]– The time the user logs in.
IDLE– The elapsed time since the user’s last interaction with the device.
JCPU– The time spent on all operations in tty.
PCPU– The time used by current user processes. Show in the field
WHAT– Current user operations and options / arguments.
The w command then lists all currently registered users and the information associated with them.
If you pass one or more usernames as arguments to the w command, the output is limited to the specified user:
22:08:55 up 12 days, 10:35, 2 users, load average: 0.00, 0.06, 0.12 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT linuxid pts/1 10.10.10.8 21:41 27:55 0.00s 0.00s bash
Command Options w
The w command accepts several options, although this one is rarely used.
--no-header Tells w not to show headers:
Only logged in users information is printed:
root pts/0 10.10.20.2 20:59 1.00s 0.02s 0.00s w -h linuxid pts/1 10.10.10.8 21:41 7.00s 0.00s 0.00s bash
--from Fields activation
FROM. Whether this archive is displayed or hidden by default depends on the distribution you are using
22:48:39 up 12 days, 11:15, 2 users, load average: 0.03, 0.02, 0.00 USER TTY [email protected] IDLE JCPU PCPU WHAT root pts/0 20:59 5.00s 0.03s 0.01s bash linuxid pts/1 21:41 1.00s 0.02s 0.00s w -f
--old-style, Tells w to use old style output. When you use this option, the command prints a blank space when it is timed
PCPU less than a minute.
22:50:33 up 12 days, 11:17, 2 users, load average: 0.14, 0.04, 0.01 USER TTY FROM [email protected] IDLE JCPU PCPU WHAT root pts/0 10.10.0.2 20:59 1:59m bash linuxid pts/1 10.10.0.8 21:41 w -o
--short Say w to use the short output. When using this option, the
[email protected]And the
22:51:48 up 12 days, 11:18, 2 users, load average: 0.04, 0.03, 0.00 USER TTY FROM IDLE WHAT root pts/0 10.10.0.2 3:14 bash linuxid pts/1 10.10.0.8 2.00s w -s
--ip-addr Give orders
w To always show the IP address instead of the hostname in a file
w Prints information about system activity and incoming users. For more information, please write
man w At your stop.
Originally posted 2020-11-18 07:12:13.