w Command Examples in Linux

The w command shows who is logged on and what they are doing. w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.

Syntax:

# w [options]

Example:

 w
20:13  up 10 days,  3:25, 2 users, load averages: 2.33 2.04 3.44
USER     TTY      FROM              LOGIN@  IDLE WHAT
geek    console  -                25Mar22 10days -
geek    s000     -                Sun12       - w

w Command Examples

1. To see whos logged in:

# w 

2. Do not print header in the output:

# w -h

3. To ignore the username:

# w -u 

4. To toggle the “from” field:

# w -f 

5. Use the short format. Don’t print the login time, JCPU or PCPU times.

# w -s

6. Display IP address instead of hostname for from field.

# w -i

7. Show information about the specified user only.

# w [user]

8. To get the version information:

# w -V 
Related Post