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.
Incorrect. who lists sessions but not the current command column.
lastIncorrect. last shows historical sessions.
Incorrect. last shows historical sessions.
wCorrect. w includes idle and current-activity information.
Correct. w includes idle and current-activity information.
uptimeIncorrect. uptime summarizes system uptime and load.
Incorrect. 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
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.