A system administrator is logged into a server as student and uses the command su - admin to switch to a different user account. To verify they are now operating under the new account before proceeding with administrative tasks, which command should they use to display only the effective username of the current session?
The whoami command prints the effective username of the current user. In the given scenario, after using su - admin, the effective user becomes admin, and running whoami will display admin. The logname command displays the name of the user who initiated the login session, which would still be student. The who command lists all logged-in users, providing more information than is necessary to simply confirm the current effective user. The lastlog command shows the most recent login time for users, not the current effective user of an active session.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the 'su' command do in Linux?
Open an interactive chat with Bash
What is the difference between 'whoami' and 'logname'?
Open an interactive chat with Bash
How does the 'who' command differ from 'whoami'?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access