Linux w Command: Show Logged-In Users and Their Processes

w shows the currently logged-in users and each session's terminal, idle time, and running tasks. It is used to look more closely at the current activity of sessions than who.

What is the w command?

The first line of the output shows the current time, uptime, number of logged-in users, and system load averages. The rows below show each user's terminal and the current task in the WHAT column. Columns may vary depending on the procps-ng implementation and configuration of the distribution.

Basic syntax

w [option] [user]

The installed implementation and options may vary by distribution. Use man w to check the description for the current system.

Examples

Viewing all sessions

Check who is logged in and what they are doing on which terminal.

w

Viewing a specific user

If you provide a username as an argument, you can focus on that user's sessions.

w alice

Print without header

Used when you want to check only the rows per user.

w -h

Reading sessions and running tasks

The upper part of w shows system uptime and load averages, and the lower part shows terminals per logged-in user and their current tasks.

w -h

Example output (values and column widths may vary depending on the environment):

alice pts/0 192.0.2.10 09:00 2:10 0.01s 0.01s vim notes.txt

-h hides only the top header, leaving the user rows. IDLE is the time there has been no input for that terminal, and WHAT summarizes the command being run in that session. Since it uses login records, in containers or some sessions the actual activity and the list may not match.

Main Options and Format

Options/Format Description
-h Hides the header of the first line.
-s Prints in a concise format.
-f Turns the display of the remote host column on or off.
-i Displays the remote host as an IP address if possible.

Precautions when using

The WHAT column is only a snapshot of the tasks associated with the current session and not a list of all background processes. JCPU and PCPU are CPU times of different scopes. In containers without login records, information may be insufficient, similar to who.

Frequently Asked Questions

Which one should I use, w or who?

A simple list of connected users, terminals, and login times can be obtained with who, and w is suitable if you want to see the current work along with idle time.

Official Documentation

The exact behavior of the options and differences between implementations can be found in the official documentation related to w.

More in This Category
Linux lsblk Command: Inspect Disks, Partitions, and Mounts

Linux lsblk Command: Inspect Disks, Partitions, and Mounts

Learn how to inspect Disks, Partitions, and Mounts with the Linux lsblk command, including practical examples, key options, and important precautions.

Linux dirname Command: Extract the Directory Part of a Path

Linux dirname Command: Extract the Directory Part of a Path

Learn how to use the Linux dirname command to remove the final component of a path and return its directory portion, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux help Command: Read Help for Bash Built-in Commands

Linux help Command: Read Help for Bash Built-in Commands

Learn how to use the Linux help command to read usage information for Bash built-in commands, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux fmt Command: Reformat Plain-Text Paragraphs

Linux fmt Command: Reformat Plain-Text Paragraphs

Learn how to reformat Plain-Text Paragraphs with the Linux fmt command, including practical examples, key options, and important precautions.

Linux head Command: Display the Beginning of a File

Linux head Command: Display the Beginning of a File

Learn how Linux head prints the first lines or bytes of files and pipelines, labels multiple inputs, excludes a trailing portion, and handles multibyte data.

Linux journalctl Command: Read systemd Logs

Linux journalctl Command: Read systemd Logs

Learn how to read systemd Logs with the Linux journalctl command, including practical examples, key options, and important precautions.

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Linux curl Command: Make URL Requests and Inspect HTTP Responses

Learn how to make URL Requests and Inspect HTTP Responses with the Linux curl command, including practical examples, key options, and important precautions.

Linux nice Command: Set a New Process's Scheduling Priority

Linux nice Command: Set a New Process's Scheduling Priority

Learn how to set a New Process's Scheduling Priority with the Linux nice command, including practical examples, key options, and important precautions.

Linux tac Command: Print Lines in Reverse Order

Linux tac Command: Print Lines in Reverse Order

Learn how Linux tac prints records from last to first, handles multiple files and custom separators, and helps inspect recent log entries in reverse order.

Linux mount Command: Inspect and Mount Filesystems

Linux mount Command: Inspect and Mount Filesystems

Learn how to inspect and Mount Filesystems with the Linux mount command, including practical examples, key options, and important precautions.