Users
The su command
Switches user inside the same session. It asks for the other user's password.
Syntax
su [-] <usuario>Most useful options
-Also loads their environment and homeCopy-ready examples
$ sudo useradd ayudante && su ayudanteSwitch user$ exitReturn to the previous userYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- The prompt changes; root's ends with #.
FAQ
Are su and sudo the same?
No: su switches user; sudo runs a single command with more privileges.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course