How to access bash without a terminal emulator?

Say I've accidentally uninstalled every terminal emulator on my system: xterm, uxterm, gnome-terminal, guake, etc. Is there a way I can access bash without a terminal emulator?

One possible way I can think of would be to create and run a shell script, but that aside, can I get an interactive shell?

This is purely hypothetical, but thanks for all the answers!


Yes, by pressing CtrlAltF21. That gives you access to virtual console TTY2 . And you can reinstall any terminal emulator from there with sudo apt-get install terminal-name, where terminal-name is, gnome-terminal for example.

To get back to the GUI, first type exit to log out of the virtual console, then press CtrlAltF7 to switch back to the GUI. (In case you want to keep TTY session open, skip the typing exit part)

Edit: June 17,2015

I've thought up another solution: if you have any C language IDE, you could compile the following code, and the console of the IDE will now give you access to bash

#include<stdio.h>
#include <unistd.h>

void main()
{
        system("bash");
}

Note: CtrlAltF2 is not the only option. You can use CtrlAltF1, CtrlAltF3, CtrlAltF4, CtrlAltF5 and CtrlAltF6 too, which will give you virtual console TTY1, TTY3, TTY4, TTY5 or TTY6 respectively.


If you have an ssh server running, than you can connect via ssh from another system.

ssh <your_remote_user_name>@<your_remote_host>

If I install a system, then I first install and start the SSH server. A kind of life insurance. =)


Ctrl+Alt+(F1 through F4 at least, maybe up to F6) run a terminal interface on the virtual consoles. Once there, to get back to the GUI, use Ctrl+Alt+F7.

If you do any of those, you should be able to get to a terminal you can login to and then access the terminal. Bash scripts will, however, continue to run, if they're automated scripts dropped into cron and such or double clicked to run (but not in terminal). The terminal emulators which 'give you' an interactive shell, but ultimately bash, zsh, etc. which are the actual shells still exist and can run either via cron, scripts, and even the virtual consoles on the keyboard combos above.

Note though that if your scripts need the interactive interface, you'll have to use the virtual consoles, or install an emulator again.


If this is a question from a test, for completeness i'd add normal serial tty's, where you'd connect to your computer with a serial cable. you'd need a getty (or whatever tty serial listeners are called now) previously configured before you lost your terminal tho, and you'd need a second computer to talk to the first, so as a home emergency this is not likely to happen.

You may also have some webmin console that gives you (in effect) shell access, though not techncally interactive shell. at that point you're better off doing easy commands, like apt-get some-terminal-emulator.

If you have a browser window open, you could in theory search for a java terminal emulator but my guess is that you'd have to install ahead of time, and just having a browser window wouldn't let you access the underlying pty's right, but I have no time to test either way.

so, the above are "what are all the possible ways" questions, not necessarily useful in real life for home, though most server rooms would probably have serial access.

hmm, a lot of other tools (emacs, vim, etc) allow some level of shelling out. lets hope you have xemacs open


Although all answers above is perfect, and since you are using Linux, then you have many other possible solutions:

  • Virtual ttys as described in @serg answer which is the perfect solution
  • SSH as described in @A.B solution which is lovely trick, but you have to take in consideration to have openssh server running.
  • Another possible solutions(it's not the perfect but just to show other possibilities): LiveCD , Recovery Mode