Join the AI Workshop to learn more about AI and how it can be applied to web development. Next cohort February 1st, 2026
The AI-first Web Development BOOTCAMP cohort starts February 24th, 2026. 10 weeks of intensive training and hands-on projects.
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
sucommand works on Linux. On macOS it will not work unless you enable the root user (tip: you can usesudoinstead)