Linux / Unix: w Command Examples

last updated in Categories , ,
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
Estimated completion time5m



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

-hDo not print header
-uIgnore current process username
-sShort format
-fShow remote hostname field
-oOld style output
--helpDisplay this help and exit
-VOutput 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
CategoryList of Unix and Linux commands
File Managementcat
Network Utilitiesdighostip
Package Managerapkapt
Processes Managementbgchrootdisownfgjobskillkillallpwdxtimepidofpstree
User Informationidgroupslastlastcommlognameuserswwhowhoamilid/libuser-lidmembers


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

2 comment

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

    From :5 (I dont see ipaddress here.)

    Still, have a question? Get help on our forum!