Skip to main content

Module 6: User & Permission Management

Lesson 60: w Command

In this lesson, you'll learn how to use the w command to display who is currently logged into your Linux system and what they are doing including session details, system load, and active processes.

The w command is one of the fastest ways to get a real-time snapshot of user activity on a Linux system.

It combines information from /var/run/utmp (active sessions) and /proc (process data) to show you not just who is logged in, but how long they have been idle, what command they are running, and how much CPU their session is consuming.

On shared servers and production systems, w is often the first command a sysadmin runs to understand what is happening.

Syntax

w [OPTIONS] [USER]

If a username is specified, w shows only that user's active sessions.

Options

Option Description
-h Suppress the header line
-s Short format β€” omit JCPU and PCPU columns
-f Toggle the FROM field (remote host) on or off
-i Display IP address instead of hostname in the FROM field
-V Display version information and exit

Understanding the w Command Output

Before diving into examples, it helps to know what each column means. Running w produces two sections: a system summary line and a per-user table.

w
18:11:29 up 1:21, 1 user, load average: 0.42, 0.29, 0.29
USER     TTY      FROM             LOGIN@   IDLE JCPU   PCPU WHAT
ravi     tty2     tty2             09:45    3.00s 0.13s  0.10s bash
ubuntu   pts/0    192.168.1.105    17:55    2min  0.05s  0.01s vim /etc/nginx/nginx.conf

System summary line:

Field What It Means
18:11:29 Current system time
up 1:21 System uptime (1 hour, 21 minutes)
1 user Number of users currently logged in
load average: 0.42, 0.29, 0.29 CPU load over the last 1, 5, and 15 minutes

Per-user columns:

Pro TecMint Β· Root Plan
This Article is for Root Members
Join Root to read the full article and unlock everything

Full Access to Every Article, Course & Certification Track

Join thousands of Linux professionals who use Pro TecMint to advance their careers.

Ad-free access to all premium articles
All courses: Learn Linux, Bash, Golang, Ubuntu and more
RHCSA, RHCE, LFCS & LFCA certification prep
New courses added every month
Private Telegram community & priority support
Root Plan
$8/mo
or $59/year billed annually
Save $37 with annual plan
Start Reading This Article in the Next 60 Seconds
Join Root Plan β†’