su
UsersFundamentals In real LinuxSwitch to another user
Name: su = substitute user (switch user)
This command needs a real Linux system; you can practise it in real Linux mode.
Description
su starts a shell as another user, root by default, asking for the **target user's** password. su - also loads that user's login environment (home, PATH …), which is usually what you want.
Many systems leave root without a password and prefer sudo.
Syntax
su [OPTION]... [USER]Common options
| - | Load the target user's environment (recommended) |
| -l / --login | Like -: a full login (their environment and home directory) |
| -c / --command COMMAND | Run a single command as that user |
| -s / --shell SHELL | Use SHELL instead of the user’s shell |