13

I know that Ctrl+Alt+FX (X=1 to X=7) are 7 different ttys.

Suddenly, I tried to find out what other combinations Ctrl+Alt+FX (X=8 to X=12) leads to.

After pressing the combinations, I found that a black screen with just a cursor blinking. Can somebody please explain me what this means. After again pressing Ctrl+Alt+F7 I can go back to the XWindows.

1 Answer 1

28

All Alt + F-key combinations lead to different virtual terminals or virtual consoles (they're also ttys, but not all ttys are virtual terminals/consoles).

If you're in X, you need to add Ctrl to that by default. This combination also works on the console these days, presumably to keep things consistent. Additionally, you can cycle through all of your allocated virtual consoles using Alt and Alt (only works on the console). If you're running X, this will eventually lead you back to your X session.

The only difference is what's running on each terminal. Generally, the first few terminals allow you to log in. If your distribution uses init (i.e. not recent Ubuntus), you can change what terminals do that by editing /etc/inittab, then typing sudo init q to activate the new configuration. Search for ‘tty1’ and you'll find the right place. Or do man 5 inittab to get all the information.

Unused consoles

A black (or white, depending on your terminal setup and platform) screen with a cursor blinking (or not, depending on your terminal setup and platform :) ) means that particular virtual terminal isn't virtually connected to anything. You can activate it by sending it something. Just type

ls -la >/dev/tty8            # if you re root
ls -la | sudo tee /dev/tty8  # if you're not

Then, with CtrlAltF8, you should see the output of ls -la.

Virtual consoles may also run other things than getty (a terminal manager program that initialises a virtual/physical terminal or modem and runs login to ask for your username and password). On some installations, one of the consoles outputs system logs. On most installations, the kernel also outputs its critical messages (or, if you're really unlucky, all of its messages) to one or more of these consoles — it could be console 1, or it could be whichever console is active.

Unallocated Consoles

The kernel saves memory by allocating a new virtual console when it's first used. If a console is unallocated, pressing its key combination does nothing, and using Alt and the arrow keys skips past it. This may make it seem like only a few of the Alt and F-key combinations are mapped to consoles, when in fact they all are.

More consoles than you know what to do with

When I first read the kernel code pertaining to this functionality, I found the kernel supported up to 63 virtual consoles. If your keyboard has more than 12 function keys, additional consoles may be mapped to the extra ones. Also, additional consoles are mapped to various key combinations. On my Debian box, 36 consoles are mapped to three sets of F-key combinations:

AltF1AltF12: tty1tty12

AltGrF1AltGrF12: tty13tty24

AltGrShiftF1AltGrShiftF12: tty25tty36

The rest can be made accessible via custom keymapping or using Alt and the arrow keys.

Graphically Challenged

Having lots of consoles used to be very useful. Many of us used to develop code on the consoles, not X (X was quite heavy on my i486/33 with its 16 megs of RAM), so several high-resolution consoles would replace the tabs on a modern, graphical terminal.

2
  • Can you tell me how to map the extra virtual consoles to new key combination? Commented Mar 20, 2012 at 6:04
  • 1
    On my Debian system, I can see 36 VCs mapped to the keyboard. I'll update the answer. This should be a separate question, though. Hint: dumpkeys to see the current mapping (look for , loadkeys to load a new mapping. Your distribution keeps a file of this mapping somewhere. You can copy it, modify it, and select the new one.
    – Alexios
    Commented Mar 20, 2012 at 9:53

You must log in to answer this question.

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