How do I log out of `sudo su`?

I'm using sudo su to start mysql and do some homework with it.

When I finish with mysql (or any other command), then I'm still in sudo.

How do I "log out", so my prompt changes back from # to $?


You don't need to use sudo and su together--su switches your user account (without arguments it switches you to root). sudo just elevates your privileges to root for the current command.

It's reccomended to use sudo instead of su if possible, but to return to your normal account after calling su, simply use the exit command


Use

su username

to get back to your user level (or a different user)

Or just press Ctrl+D to exit out of root


  • logout if used sudo su -
  • exit if used sudo -s