Multi-user UNIX: Which command displays information about all users who are currently logged in to the system (terminals or sessions)?
-
Awhich
-
Bwho
-
Cwho am i
-
D1 /u
-
ENone of the above
Answer
Correct Answer: who
Explanation
Introduction / Context:UNIX is a multi-user operating system. Administrators and users frequently need to see who is presently logged in, from which terminals or pseudo-terminals, and sometimes at what times, for collaboration or troubleshooting sessions.
Given Data / Assumptions:
- You are on a multi-user UNIX or Linux system.
- You want a system-wide list of current logins, not just your shell session.
- Standard coreutils and traditional UNIX commands are available.
Concept / Approach:The command “who” lists all logged-in users with their terminals and login times. The variant “who am i” (or “whoami” as a different command) pertains to your current effective user/session only. The command “which” traces the path to executables in your PATH and is unrelated. The text “1 /u” is not a valid command in this context.
Step-by-Step Solution:
Open a shell and type “who”.Review the output lines, each corresponding to a logged-in user/session.Optionally use “w” for more detail (processes and load), or “users” for just usernames.Verification / Alternative check:Compare “who” with “w”: the latter shows CPU usage and the command currently running. “who am i” returns information about your current session line only.
Why Other Options Are Wrong:which: finds executables, not users. who am i: only your session, not all users. 1 /u: not a valid command. None: incorrect because “who” is correct.
Common Pitfalls:Confusing “whoami” (single word) with “who am i”; misinterpreting pseudo-terminals (pts/0, pts/1) as remote logins when they may be local terminal emulators.
Final Answer:who