That's a very perceptive question! While both commands tell you who is logged in, they provide different levels of detail. Think of who as a simple list and w as a detailed status report.
Here are the main differences:
1. The who Command (The "Simple List")
The who command is quite basic. It typically shows:
- User name
- Terminal name (the "line" they are on)
- Login time
- Remote hostname (if they logged in via a network)
Example output:
labex pts/0 2025-12-24 20:06
2. The w Command (The "Detailed Summary")
The w command is more powerful. It combines the information from who, uptime, and information about what users are actually doing. It shows:
- System Summary: The current time, how long the system has been running, how many users are logged in, and the "load average" (how busy the computer is).
- Idle Time: How long it has been since the user typed anything.
- JCPU/PCPU: Technical details about how much CPU power the user's processes are using.
- WHAT: This is the most useful part—it shows the actual command or process the user is currently running.
Example output:
20:10:46 up 111 days, 3:31, 1 user, load average: 1.25, 0.58, 0.32
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
labex pts/0 172.17.0.1 20:06 0.00s 0.02s 0.00s w
Summary Comparison:
| Feature | who |
w |
|---|---|---|
| Simplicity | High (just IDs and times) | Lower (more columns) |
| System Stats | No | Yes (Uptime, Load) |
| Activity | No | Yes (Shows the current command) |
In short: Use who if you just want to see a quick roster of names. Use w if you want to know what's happening on the system and how busy it is!