0
0
Linux CLIscripting~5 mins

su (switch user) in Linux CLI - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the su command do in Linux?
The su command lets you switch from your current user to another user account in the terminal. It stands for "switch user."
Click to reveal answer
beginner
How do you switch to the root user using su?
You type su and press Enter. Then you enter the root user's password when asked. This gives you root access.
Click to reveal answer
intermediate
What is the difference between su and su -?
su switches user but keeps your current environment. su - switches user and loads the new user's full environment, like a fresh login.
Click to reveal answer
beginner
How do you switch to another user named alice using su?
You type su alice and press Enter. Then enter Alice's password when prompted.
Click to reveal answer
beginner
Why might you use exit after using su?
Typing exit logs you out of the switched user session and returns you to your original user.
Click to reveal answer
What does the command su - do differently than su?
ALogs out the current user
BSwitches user but keeps the current environment
CShows the current user name
DSwitches user and loads the new user's environment
Which password do you need to enter when you run su alice?
AAlice's password
BYour own password
CRoot password
DNo password is needed
What happens if you type su without a username?
ASwitches to root user
BSwitches to guest user
CShows an error
DLogs out current user
How do you return to your original user after using su?
AType <code>logout</code>
BClose the terminal
CType <code>exit</code>
DPress Ctrl+C
Why is su useful in Linux?
ATo update software automatically
BTo switch between different user accounts
CTo create new files
DTo check disk space
Explain how to switch to the root user using su and how to return to your original user.
Think about logging in as root and then logging out.
You got /3 concepts.
    Describe the difference between su and su - and when you might use each.
    Consider how environment variables and settings change.
    You got /3 concepts.