7

Related to TTY numbers, it looks like there are 64 TTYs (find /dev -name 'tty[0-9]*' | cut -c 9- | sort -n | tail -n 1 and documentation). tty0 is the current virtual console, Ctrl+Meta+F1 reports that it's connected to tty1, and tty in a GNOME terminal reports that it's connected to /dev/pts/N. Only TTYs 1 through 12 can be accessed using the well-known Ctrl+Meta+F* keyboard shortcuts, so what are /dev/ttyN 13 through 64 used for?

2
  • May I ask why you ask about 12<N<64 instead of 7<N<64? Are 7<N<13` any different from 12<N<64, or you already know what 7<N<13` are used for?
    – Tim
    Commented Nov 30, 2018 at 19:47
  • @Tim I've added a clarification.
    – l0b0
    Commented Dec 1, 2018 at 8:12

3 Answers 3

8

Again, as I answered to this question, it is entirely up to whoever sets the system up. Normally only a limited number of gettys are started, as people nowadays use X instead of a tty (or use screen(1)...), starting more than a handful is waste. If you want to start gettys on all 64, feel free.

The pty (and some other exotic starting letters) are pseudo ttys, faked by software to run e.g. xterms and other tty users, in contrast to the "real" ttys (which aren't so real anymore...).

6

Normally they are unused .
All tty13tty63, when not specially activated, cost only 3 × 51 special files in /dev/ (one tty, one vcs, and one vcsa for each console), and 51 NULL pointers in the kernel memory. When a console is unused, kernel doesn’t allocate any data for it (besides aforementioned pointer in vc_cons[]).

Ask Linus Torvalds why he choose #define MAX_NR_CONSOLES 63 (and not 31, for example) in tty.h.

3

Computers or other devices running Linux can have any number (including 0) of keyboards or input device of any shape and layout connected to them which can have any number of function keys.

The kernel in its default configuration allows up to 63 virtual consoles to be allocated and provides an API to map input events to switching consoles, and also to allocate/deallocate/switch console programmatically (see the ioctl_console(2) man page).

The loadkeys utility can be used to load that mapping, dumpkeys to dump it.

For instance, here with a typical British basic USB PC keyboard (with F1 .. F12 keys) connected to a PC running Ubuntu 18.04, dumpkeys indicates that consoles 1 to 12 can be switched to with Alt-F1 to Alt-F12, consoles 13 to 24 with AltGr-F1 to AltGr-F12, consoles 25 to 36 with Alt+Shift+F1 to Alt+Shift+F12, and I can use Alt+Left and Alt+Right to cycle through consoles (which allows me to access consoles above 36).

And I can allocate more consoles with openvt (though it's enough to open the tty device to allocate it) or switch between them with chvt.

You must log in to answer this question.

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