List current users with idle time, CPU time, and the command they are running.
Which command is appropriate?
w shows current login sessions plus idle time and the WHAT column for the active command.
Detailed explanation
whoIncorrect. who lists sessions but not the current command column.
lastIncorrect. last shows historical sessions.
wCorrect. w includes idle and current-activity information.
uptimeIncorrect. uptime summarizes system uptime and load.
Try it yourself
An example you can run in a temporary verification environment.
w -h 2>/dev/null | sed -n '1,3p'; printf '%s
' 'w shows current user activity'Expected result
login中ならactivity行、続いて確認文字列Key points
- WHAT is current command
- Idle time
- Current sessions
Notes
- Environment: procps-ng w / 読み取り専用
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Permission bit
A mode bit controlling read, write, execute, or special execution behavior.
Account state
Attributes that determine whether a password or login account can be used.
Resource limit
A per-process or per-user ceiling such as open files or process count.