w: command not found

The w command is primarily used to display the details of users who are currently logged in to a system and their transactions. The first line of the output displays the status of the system. The second line of the output displays a table with the first column listing the users logged in to the system and the last column indicating the current activities of the users. The remaining columns of the table show different attributes associated with the users.

Syntax

The syntax of the w command is:

$ w [options] [user name]

An example of the w command is shown in the following example:

# w
 16:48:16 up 348 days,  8:06,  1 user,  load average: 2.90, 3.53, 3.51
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
geek pts/77   xx.xx.xx.xx          11:11    0.00s  0.31s  0.09s sshd: geek[priv]

The output shows rows of data with the following columns:

Field Description
USER User login name
TTY The controlling Terminal type, listed as pts/N (pseudo-terminal) in GUI, or ttyN on the system console or other directly connected device
FROM Remote hostname from which the user has logged in
LOGIN@ Login time of the user
IDLE How long it has been since the user typed any input on that Terminal
JCPU CPU time consumption of all the processes attached to tty, including jobs currently running in the background
PCPU CPU time consumption of the current processes named in the WHAT field
WHAT The command line of the process currently executing

If you encounter below error while running the w command:

w: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Arch Linux pacman -S procps-ng
CentOS yum install procps-ng
Fedora dnf install procps-ng

w Command Examples

1. Show logged-in users info:

$ w

2. Show logged-in users info without a header:

$ w -h
Related Post