31

I entered sudo -s command in terminal, and the it changed from

shameek@shameek-K55VD:~$ 

to

root@shameek-K55VD:~#. 

Now when I click on the close terminal window icon it says, "There is still a process running in the terminal, closing it may kill it".

Close this terminal? dialog box

I am entirely new to Ubuntu, please suggest a command to get back from

root@shameek-K55VD:~# 

to

shameek@shameek-K55VD:~$

and then I can close the terminal.

  • 1
    If you are sure that you've finished whatever you was doing in terminal, just close by killing the [possible] process... – Gediminas Jeremiah Gudelis Sep 6 '13 at 6:06
  • By using "exit" or Ctrl-D, you will be warned if there are any background processes which need a terminal. Forcibly closing the terminal may cause work to be lost otherwise. – wallyk Sep 6 '13 at 21:57
62

Press Ctrl+D will log you out of Super User and return you to normal user status. Alternatively, you can type exit

  • 11
    With 1 slight cave-at: if $IGNOREEOF is active control-d is not useable. – Rinzwind Sep 6 '13 at 5:47
  • 4
    To add an explanation of what is happening: sudo -s really just starts a new shell as the root user as a subprocess, rather than changing the credentials of the existing shell. To the Terminal, this is indistinguishable from any other command that is still running. You exit the inner shell just as you would exit any other. This also means that shells are stackable -- you can just invoke bash and get a new shell inside the old one. – Simon Richter Sep 6 '13 at 17:47
  • 1
    Also, if you haven't reset it, the SHLVL environment variable will tell you how many layers of shell you have running. – Aesin Sep 7 '13 at 11:58
34

Type exit then you will log off to normal user. Then type exit again to close the terminal or just close it with the mouse.

GNOME Terminal showing exit command to escape from a subshell

  • @EliahKagan what exactly is the difference between sudo su and sudo -s? – acolyte Sep 6 '13 at 13:33
  • sudo -s will not run shell environment which is specified in passwd file. But it will not change some environment variables ex: $HOME – dedunumax Sep 6 '13 at 14:28
13

If you're not doing anything important in the terminal, you can actually just click Close Terminal on the Close this terminal? ("Closing the terminal will kill it") dialog box.

This will send SIGHUP to the running shell, which will then quit, just like it would if you used the exit command or Ctrl+D (also good ways).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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