w Command
Beginner User Management man(1)Show who is logged in and what they are doing
๐ 114 views
๐
Updated: Apr 28, 2026
SYNTAX
w [OPTION]... [USER]
What Does w Do?
w displays who is logged in and what they are doing. It shows the username, terminal, remote host, login time, idle time, CPU usage, and the current command for each logged-in user.
w combines the functionality of who (who is logged in) and uptime (system load). It is a quick way to see system activity, identify idle sessions, and check how many people are using the system.
w is commonly used for security monitoring (who is connected), capacity planning (how busy is the system), and troubleshooting (what are users running).
w combines the functionality of who (who is logged in) and uptime (system load). It is a quick way to see system activity, identify idle sessions, and check how many people are using the system.
w is commonly used for security monitoring (who is connected), capacity planning (how busy is the system), and troubleshooting (what are users running).
Options & Flags
| Option | Description | Example |
|---|---|---|
| -h | Do not print header | w -h |
| -s | Short format | w -s |
| -f | Toggle showing FROM field | w -f |
| -u | Ignore current process username | w -u |
| username | Show only specific user | w admin |
Practical Examples
#1 Show all users
Shows who is logged in, their terminal, source, idle time, and current command.
$ w
Output:
USER TTY FROM IDLE WHAT
admin pts/0 192.168.1.50 0.00s w
jdoe pts/1 10.0.0.100 5:30 vim deploy.sh
#2 Short format
Shows abbreviated output without login time and CPU columns.
$ w -s#3 Specific user
Shows sessions only for the admin user.
$ w admin#4 Without header
Shows logged-in users without the header line โ useful in scripts.
$ w -h#5 Count logged-in users
Counts the number of active user sessions.
$ w -h | wc -l
Output:
3
Tips & Best Practices
Quick system overview: w shows users, load average, and uptime in one command โ perfect for a quick check when connecting to a server.
IDLE column: IDLE shows how long since the user last typed. High idle times may indicate forgotten sessions or hanging connections.
FROM may be empty: The FROM field shows the source IP/hostname. It may be empty for console logins or local sessions.
Frequently Asked Questions
How do I see who is logged in?
Use w for detailed info (user, terminal, IP, idle time, current command), or who for simpler output.
What does the IDLE time mean?
IDLE shows time since last keyboard/mouse activity. Long idle times may indicate inactive sessions that should be closed.
How do I kick a user off the system?
Find their terminal with w, then: sudo pkill -t pts/N to kill all processes on that terminal.
Related Commands
More User Management Commands
Download User Management Cheat Sheet
View all 31 Linux command cheat sheets โMaster Linux with Professional eBooks
Curated IT eBooks covering Linux, DevOps, Cloud, and more
Browse Books โ