Learn w Command in Linux & BSD with Examples

2 min

Here’s a beginner’s guide on understanding the w command in Linux & BSD with several examples.

This article is part of the Linux command learning series.

w command

The w command is a utility in Linux that displays information about the users currently logged into the system and their processes. It shows who is logged on and what activities they are doing. That means it can show what processes they are running in their system.


Here is the basic syntax of the w command:

w [options] [username]

The w command takes an optional list of options, followed by an optional username. If a username is specified, w will only show information about processes owned by that user.

Examples of the w command and its usage

Here are some examples of using the w command.

When you run it with only w, it shows the following output.

$ w
 21:45:07 up 1 day, 12:48,  1 user,  load average: 1.05, 0.85, 0.56
debugpoi tty2      Thu08   36:48m  0.03s  0.03s /usr/libexec/gnome-session-binary
a basic output of w command in Linux
basic output of the w command in Linux

Explanation: The USER column gives you the username, followed by the terminal number, login date-time, IDLE time, CPU usage, and the process being executed by the user.

  • USER – Logged on user name in your Linux or BSD system.
  • TTY – Terminal identifier number for the current session.
  • FROM – Hostname or IP address of the user.
  • LOGIN@ – User logged in time. It sometimes shows dates based on your system settings.
  • IDLE – Idle time elapsed since the user interacted with the terminal.
  • JCPU – CPU time used by all the user processes for that session.
  • PCPU – Time used by the process for the user, which is mentioned in the WHAT field.
  • WHAT – Current process with arguments.

Here’s another example of the w command with two users logged in a virtual machine environment. As you can see, two user names are shown with separate processes with process parameters currently running.

w command output for a demo multi-user environment
w command output for a demo multi-user environment

Let’s take a look at some options for this command.

To show stop showing header, use the -h option. It’s identical to the --no-header switch.

$ w -h

The -f option toggles the visibility of FROM field in your output.

$ w -f

Use the -s option to print a short version of the output excluding JCPU, PCPU and LOGIN@ information.

$ w -s

To show a list of all processes owned by a specific user (for example, debugpoint):

$ w debugpoint

Closing Notes

I hope this article helps you to understand w command and its basics. You can also read the w man pages to learn more. Let me know if you have any questions.

This article is part of the Linux command learning series.


Creator and author of debugpoint.com. Connect with me via Telegram, 𝕏 (Twitter), or send us an email.
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments