32

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.

2
  • 1
    If you are sure that you've finished whatever you was doing in terminal, just close by killing the [possible] process... Sep 6, 2013 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, 2013 at 21:57

3 Answers 3

64

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

3
  • 11
    With 1 slight cave-at: if $IGNOREEOF is active control-d is not useable.
    – Rinzwind
    Sep 6, 2013 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. Sep 6, 2013 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, 2013 at 11:58
35

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

2
  • @EliahKagan what exactly is the difference between sudo su and sudo -s?
    – acolyte
    Sep 6, 2013 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
    – dedunu
    Sep 6, 2013 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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .