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 ln Command: Create Hard Links and Symbolic Links

Linux ln Command: Create Hard Links and Symbolic Links

Learn how to create hard links and symbolic links with Linux ln, choose relative or absolute targets, replace links safely, and inspect link behavior.

Linux locate Command: Search Indexed File Paths Quickly

Linux locate Command: Search Indexed File Paths Quickly

Learn how Linux locate searches a filename database, how updatedb affects freshness, how to limit and filter matches, and when find is the better tool.

Linux Tutorial / Choosing a Linux Distribution

Linux Tutorial / Choosing a Linux Distribution

Explore major Linux distributions and learn when to choose Ubuntu LTS or Rocky Linux for study and server practice. Compare package management, release policies, and practical selection criteria.

Linux hostnamectl Command: Show and Change the Host Name

Linux hostnamectl Command: Show and Change the Host Name

Learn how to show and Change the Host Name with the Linux hostnamectl 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 umask Command: Control Default File Permissions

Linux umask Command: Control Default File Permissions

Learn how to control Default File Permissions with the Linux umask command, including practical examples, key options, and important precautions.

Linux cat Command: Display and Concatenate File Contents

Linux cat Command: Display and Concatenate File Contents

Learn how to use the Linux cat command to display text files, concatenate multiple files, number lines, reveal hidden characters, and avoid unsafe redirection mistakes.

Linux top Command: Monitor Processes in Real Time

Linux top Command: Monitor Processes in Real Time

Learn how to monitor Processes in Real Time with the Linux top command, including practical examples, key options, and important precautions.

Linux uniq Command: Remove or Count Adjacent Duplicate Lines

Linux uniq Command: Remove or Count Adjacent Duplicate Lines

Learn how to remove or count adjacent duplicate lines with the Linux uniq command, including practical examples, key options, and important precautions.

Linux rpm Command: Inspect RPM Packages and the Installed Database

Linux rpm Command: Inspect RPM Packages and the Installed Database

Learn how to inspect RPM Packages and the Installed Database with the Linux rpm command, including practical examples, key options, and important precautions.