List current users, their terminals, login times, and remote sources.
Do not display their current commands.
Which command is appropriate?
who lists current login sessions from utmp-style data, including terminal and login time.
Detailed explanation
lastIncorrect. last displays historical login and logout records.
Incorrect. last displays historical login and logout records.
whoCorrect. who lists current sessions with the requested details.
Correct. who lists current sessions with the requested details.
idIncorrect. id displays UID and group identity.
Incorrect. id displays UID and group identity.
usersIncorrect. users lists names but omits the requested details.
Incorrect. users lists names but omits the requested details.
Try it yourself
An example you can run in a temporary verification environment.
who 2>/dev/null | sed -n '1,3p'; printf '%s
' 'who reads current login sessions'Expected result
login中ならsession行、続いて確認文字列Key points
- who shows current sessions
- last shows history
- users is a short form
Notes
- Environment: GNU coreutils who / 読み取り専用
- 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.