System and processes

The w command

Shows who is logged in, what each one is doing, and the system load average.

Most useful options

-h, --no-headerDrops the header with the time, uptime, user count and load
-s, --shortShort format: no login time and no CPU times
-f, --fromShows or hides the FROM column with the remote host. By default it is usually not shown
-u, --no-currentIgnores your own user when working out each session's process and CPU time
-o, --old-styleOld style: leaves blank space for idle times under one minute
-p, --pidsShows the PID of the login process or of the one listed in WHAT

Copy-ready examples

$ wsystem load and active sessions, with the full table.
$ w -honly the table, without the header. Useful for filtering with grep or awk.
$ w -sshort format, without login time or CPU times.
$ w -fadds the FROM column with the host each session connected from.
$ w anaonly the sessions of the user ana.

You can try them in the browser terminal: it does not touch your computer.

Common errors

MessageCauseFix
bash: w: command not foundw is part of the procps (procps-ng) package. In containers and minimal systems it may not be installed.Install it with your distribution's package manager, for example apt install procps on Debian or Ubuntu.
w: invalid option -- 'Q'w has no such option. Mixing it up with who or uptime is common.Check the valid options with w --help.

Typical mistakes

  • The load is not a CPU percentage: it counts processes ready to run or waiting for I/O, and it is not normalized by core count.
  • IDLE is the time without activity on the terminal. JCPU adds up the CPU of all processes on that terminal, and PCPU only the one listed in WHAT.
  • Some distributions show the FROM column by default, so the output can differ from one system to another.

Differences from similar commands

  • who: lists sessions with login time and origin, without load or the WHAT column. w adds those.
  • uptime: prints only the header line that w shows: time, uptime, users and load.

Related commands

FAQ

What does load average 0.15 0.10 0.05 mean?

The average load over 1, 5 and 15 minutes. On a single-core machine, a value that stays above 1 means processes are waiting.

Why doesn't w show the FROM column?

In the original release of the program it is not printed by default. Use -f to show it; some distributions turn it on by default.

What is the difference between JCPU and PCPU?

JCPU is the CPU time of all processes on the terminal. PCPU is only the time of the process listed in WHAT.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course