I accidentally pressed Ctrl+Alt+F12 and my display turned to black… I then had to make a reboot.. What did it do to my system? Also what does Alt+ F8 to F10 do?
Ubuntu – What does “Ctrl + Alt + F12” do
shortcut-keys
shortcut-keys
I accidentally pressed Ctrl+Alt+F12 and my display turned to black… I then had to make a reboot.. What did it do to my system? Also what does Alt+ F8 to F10 do?
Best Answer
Pressing Ctrl+Alt+Fn (or just Alt+Fn when not in X11, the GUI) switches to the nth virtual console (
ttyn
).Often we talk about a virtual console as a usable text console. So we often say there are six virtual consoles, accessible with Alt+F1 through Alt+F6 (holding down Ctrl too if you're in the GUI when you want to switch). And we often say that then, separately, is the GUI, which can be switched (back) to with Alt+F7.
But in fact,
tty7
, where the GUI typically runs, is a virtual console too. It's just not usable as a text console, because it doesn't havegetty
running for it.getty
runs fortty1
throughtty6
(by default).getty
sets a virtual console up to be used like a terminal and runslogin
to prompt for a username and password.You can see the
getty
commands that are running by filtering the output ofps
:Since
tty7
is the first virtual console that is not set up to behave like a terminal (i.e., nogetty
is running for it), that's the one X11 (which provides the GUI) uses.Virtual consoles higher than
tty7
exist also. It's just that, ordinarily, they neither havegetty
running for them, nor do they have X11 using them. The first 12 virtual consoles are accessible with the key combinations described above using function keys (because a keyboard typically has only 12 numbered function keys). They are accessible even if nothing is happening on them.Thus, when you press Ctrl+Alt+F12, you get a blank screen because you are now on
tty12
, which has nothing at all running on it.As an interesting exercise, you might try running:
Then press Alt+F12 (or Ctrl+Alt+F12 if you're in the GUI rather than one of the first 6 virtual consoles).
This will bring you to
tty12
, which now has a login screen and is usable as a terminal.(If you wanted to permanently create usable text-based consoles on higher-numbered virtual consoles, then you should configure
init
to rungetty
for them automatically. Whengetty
is run manually as above, or even if you were to add that line to a startup script, you won't get the ability to login again after logging out on the virtual console, becausegetty
won't automatically run again. Furthermore, there are some other problems runninggetty
in that way for production use--for example,bash
job control might not be available in your login shell, after you log in. If you want to make more virtual consoles usable as text-based terminal emulators, I recommend asking a separate question about that.)