Difficulty: Easy
Correct Answer: who am i
Explanation:
Introduction / Context:
When working on multi-user UNIX systems, it is useful to confirm which account you are using and the terminal or remote session you occupy. Multiple commands provide identity or environment information, and choosing the right one depends on what detail you need.
Given Data / Assumptions:
Concept / Approach:
The who command reports logged-in users. With the am i arguments, it returns details of the current session: username, terminal, login time, and possibly source host. Alternatives like id print UIDs/GIDs numerically, and pwd prints the present working directory, not user identity. which only locates executables in PATH.
Step-by-Step Solution:
Verification / Alternative check:
Compare who am i output with environment variables like $USER and $LOGNAME, and with id -un for consistent identity information. On SSH, check last or w for session history and current processes.
Why Other Options Are Wrong:
a: which shows where a command binary resides, not user identity.
b: pwd prints your current directory path.
c: i /4 is not a standard UNIX command.
e: Not applicable because who am i is correct for user/session info.
Common Pitfalls:
Assuming $USER always reflects effective UID; in sudo contexts, id and who may reflect different identities; misreading who output fields when connected via remote TTYs.
Final Answer:
who am i
Discussion & Comments