Linux / Unix: w Command Examples

w command

I am a new Linux and Unix system user. How do I list current users and find out what they’re doing on Linux or Unix-like operating system using shell prompt?

The w command displays a list of all logged in to the server and what they are doing. This command is similar to who command, but ends up displaying more information about logged in users.[donotprint]

w command details
DescriptionWho is on system
and what they're doing
Root privilegesNo
Est. reading time5m
Table of contents


Display who is logged into the Linux/Unix server and what they are doing at command execution time.


The basic syntax is as follows:

w [UserNameHere] w [UserNameHere1] [UserNameHere2] w [options] w [options] [UserNameHere]

Understanding w command output / header

The w command shows the following information about each user and their process on the system:

  1. USER – User name.
  2. TTY – Terminal type such as pts/0 or console.
  3. FROM – The remote host name or IP address.
  4. LOGIN@ – Login time.
  5. IDLE – Idel time.
  6. JCPU – The JCPU time is the time used by all processes attached to the tty.
  7. PCPU – The PCPU time is the time used by the current process displayed in WHAT field.
  8. WHAT – The command line of USER’s current process.

w command examples

To see who is currently logged in and what they are doing on your Linux/Unix-based server, type:
$ w
Sample outputs:

Fig. 01: w command in action

Fig. 01: w command in action

The first line of output in this example, displays the current time of day, how long the system has been running, the number of users logged into the system, and the load averages.

Hide the header

To suppress the heading pass the -h option:
$ w
Sample outputs:

vivek    pts/0      14:10    3:24m  2.15s  0.00s dbus-launch --auto
root     pts/1      14:51    1:41m  0.16s  0.00s pager -s
nixcraft pts/2      14:52   13:07   0.41s  0.02s vi /etc/passwd
root     pts/3      17:21    3.00s  0.12s  0.01s w -h

Ignore usernames

$ w -u

Use short output format

To hide the login time, JCPU or PCPU times:
$ w -s
Sample outputs:

 17:42:36 up  3:36,  4 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM              IDLE WHAT
vivek    pts/0       3:31m dbus-launch --autolaunch 9ee90112ba2cb
root     pts/1       1:48m pager -s
nixcraft pts/2      20:12  vi /etc/passwd
root     pts/3       4.00s w -s

Hide/show the FROM field

Toggle printing the from (remote hostname) field. The default as released is for the from field to not be printed:
$ w -f

How do I show information about the specified user only?

To see information about user named ‘vivek’, type:
$ w vivek
Sample outputs:

 17:40:02 up  3:34,  4 users,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
vivek    pts/0      14:10    3:29m  2.15s  0.00s dbus-launch --auto

w command options

Option Description
-h Do not print header
-u Ignore current process username
-s Short format
-f Show remote hostname field
-o Old style output
--help Display this help and exit
-V Output version information and exit

Related media

This tutorials is also available in a quick video format:

See also
  • w(1) Linux/Unix command man page

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • enigma Apr 7, 2014 @ 7:13

    Hello Sir,
    Can u please help me decode what does this mean in W cmd’s output

    From :5 (I dont see ipaddress here.)

    • Rahul Mehetar Jul 27, 2016 @ 7:32

      get ssh to your system and then try “w”

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum