Skip to content

Linux commands: su

New Course Coming Soon:

Get Really Good at Git

A quick guide to the `su` command, used to switch the shell to another user

While you’re logged in to the terminal shell with one user, you might have the need to switch to another user.

For example you’re logged in as root to perform some maintenance, but then you want to switch to a user account.

You can do so with the su command:

su <username>

For example: su flavio.

If you’re logged in as a user, running su without anything else will prompt to enter the root user password, as that’s the default behavior.

su will start a new shell as another user.

When you’re done, typing exit in the shell will close that shell, and will return back to the current user’s shell.

The su command works on Linux. On macOS it will not work unless you enable the root user (tip: you can use sudo instead)

Are you intimidated by Git? Can’t figure out merge vs rebase? Are you afraid of screwing up something any time you have to do something in Git? Do you rely on ChatGPT or random people’s answer on StackOverflow to fix your problems? Your coworkers are tired of explaining Git to you all the time? Git is something we all need to use, but few of us really master it. I created this course to improve your Git (and GitHub) knowledge at a radical level. A course that helps you feel less frustrated with Git. Launching May 21, 2024. Join the waiting list!

Here is how can I help you: