9

As I know

  • tty1 for gui login page
  • tty2 for gui using
  • tty3-6 for user using

What are tty0,tty7-tty63 and ttyS0-ttyS31 used for?

muru
  • 197,895
  • 55
  • 485
  • 740
MohamedJ
  • 109
  • tell me what's wrong or recommend a book or something that helps ^^ @Rinzwind – MohamedJ Jul 03 '22 at 14:47
  • 6
    I think @Rinzwind might be writing an answer right now :-) ... meanwhile: https://tldp.org/HOWTO/html_single/Text-Terminal-HOWTO/ – Raffa Jul 03 '22 at 14:51
  • 2
    @Raffa I was but Formula 1 has priority ;-) – Rinzwind Jul 03 '22 at 15:28
  • 2
    I posted this a couple of days ago if interested in how to use tty8: https://askubuntu.com/questions/1416942/what-is-the-purpose-of-ctrlaltf8/1416947#1416947 – Rinzwind Jul 03 '22 at 16:00
  • No /dev/ttys* devices exist on my system. Perhaps you're asking about /dev/ttyS*, the serial ports? – Peter Cordes Jul 04 '22 at 12:52

1 Answers1

21

From a distribution agnostic viewpoint:

tty%d (numeric suffix, with no letter between, starting from 1) are all "virtual consoles" which have no specific designated purpose. These can be text terminals, or a graphical server can be launched on top of the text terminal. These might be dynamically allocated. Some distros will start their first graphical interface on a specific one of these, but which one has changed several times and subsequent ones will be dynamically assigned.

tty0 is special. Rather than a real tty, this is internally aliased by the kernel to the current active virtual console. It can be treated as a normal tty device, except that it won't work until one of the other tty%d devices has been initialized and assigned as console.

ttyS%d are hardware serial ports. The devices are likely preallocated and may not necessarily correspond to existing serial hardware. But if you do have directly connected serial ports, they typically are assigned sequentially starting from ttyS0

If you have USB serial devices, they may show up as /dev/ttyUSB%d or ttyACM%d depending on the underlying device model, and number assignment varies depending on order they were plugged in and they may get shuffled if they are unplugged and replugged.

Thanks to Rinzwind for these details on typical distribution specific virtual console uses:

  • In gnome3, tty1 is the first GUI desktop. gnome2 uses tty7 instead.
  • getty (text login prompt) is set up on tty1 - tty6
  • tty8 - tty12 are typically left with nothing on them, but they can be claimed by anything, and both GUI and getty interfaces can be added with some config file changes (typically systemd) or by spawning additional GUI logins.

Typically you switch to a virtual console with alt-Fkey (where Fkey is one of the function keys F1-F12) (or ctrl-alt-Fkey if you were in a GUI) so to access consoles above 12, you have to either bind a custom console key to that or switch to it with a command line tool or some other method (like alt-arrow).

user10489
  • 4,051
  • 5
    Nah you can have it :) Seems good enough. Besides this ( :) ): tty1 is gnome3 desktop. tty7 is also used instead of tty1 on gnome2. tty8 through 12 are used but not configured. You can connect those to another desktop or to a command (like htop) through a systemd service. 13 and higher are unused and unconfigured so if you want those it requires a bit of tinkering – Rinzwind Jul 03 '22 at 15:58
  • Edit if you think I left anything out or got something wrong... – user10489 Jul 03 '22 at 16:59
  • Hah! I left out tty0. – user10489 Jul 03 '22 at 17:21
  • Unraveling the Mystery of tty0 – yurenchen Aug 29 '23 at 08:54