1

My Ubuntu 18.04 has /dev/tty{0..63} (and /dev/ttyS{0..31}). Does it mean I have 63 virtual consoles (/dev/tty0 isn't an independent virtual console, and /dev/ttyS{0..31} are perhaps not virtual consoles)?

But I can only access /dev/tty{1..7}, by Ctrl+Alt+F{1..7}. Is this number 7 because there is some file similar to /etc/ttys which specifies a list of devices, and init reads in the file and fork a child for each terminal device in the file, and each child execute getty and getty opens the terminal device?

Why does this post mention 7 ("8 upwards are unused or at least non-interactive (here they show only a blinking cursor)."), while another post by the same author mention 11 or 12 ("what are /dev/ttyN for 12<N<64 used for?")? JdeBP kindly pointed me to the posts.

Thanks.

3

My Ubuntu 18.04 has /dev/tty{0..63} (and /dev/ttyS{0..31}). Does it mean I have 63 virtual consoles (/dev/tty0 isn't an independent virtual console, and /dev/ttyS{0..31} are perhaps not virtual consoles)?

Yes, you have 63 virtual consoles. /dev/tty0 corresponds to whichever one is currently active, and /dev/ttyS* are serial connections.

But I can only access /dev/tty{1..7}, by ctrl-alt-F{1..7}. Is this number 7 because init forks only 7 child processes to run getty? (presumably there is some file similar to /etc/ttys which specifies a list of devices, and init reads in the file and fork a child for each device in the file)

Mostly correct. You can actually access any of them, though for reliable access to consoles with numbers higher than the number of Function keys on your keyboard, you need to use the chvt command.

Why does this post mention 7 ("8 upwards are unused or at least non-interactive (here they show only a blinking cursor)."), while another post by the same author mention 11 or 12 ("what are /dev/ttyN for 12

Seven is the de-facto number used on most older Linux systems. The first six are used for actual text logins, and the seventh is used for the graphical environment. Newer systems that use systemd instead allocate consoles on-demand, with the first console being the graphical environment by default on systems which have a graphical environment configured.

However, you can usually (easily) get to 12 of the virtual consoles by holding the Ctrl and Alt keys and hitting the appropriately numbered Function key on your keyboard, simply because most modern keyboards have 12 function keys. On some keyboards, you may have easy access to 15 (some older keyboards had 15 function keys), and on some it may be possible to get to even higher numbers by adding other modifier keys to the key combination.

As far as why there's 63 devices, that's largely an artefact of how device numbers got allocated.64 numbers were assigned for virtual consoles, and the first one was needed so that code could easily address the currently active virtual console.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.