Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use sudo su command to do something in Mac OS X but don't know how to switch back.

Hope you guy can do me a favour.

share|improve this question

migrated from Mar 23 '12 at 9:16

This question came from our site for professional and enthusiast programmers.

By the way, a more straightforward way to get a root shell with sudo is sudo -s. – Spiff Mar 23 '12 at 9:45
how is -s more straightforward than su ? does it behave any differently? – Damon Feb 24 '14 at 3:03

Type exit. This will logout the super user and go back to your account.

share|improve this answer

If you run sudo su, that will open a shell as the superuser. Type exit or Ctrl-D to exit this shell.

Normally, you don't run sudo su, but you just run sudo command. Once you type your password, sudo will record a timestamp and let you run more commands under sudo without having to type your password for a few minutes. If you want to clear that timestamp (so that someone else can't run sudo without a password), you can run sudo -k.

share|improve this answer

su is used to login into the root account, to logout from this , use Ctrl+D or type exit. Playing with su is very dangerous if not really necessary. The better idea is to add the used into sudo group and use the sudo command. And how come you use sudo su??

share|improve this answer

Just type exit, and to verify that you're back to "you" type "whoami" and it should NOT say root.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.