What are ttys for?

2

I use Fedora 23 and CTRL + ALT + F1 to CTRL + ALT + F6 I'm going to access these terminals, I only need to use them when graphic mode hangs and I need to restart gnome and I have the definition that these > are terminals without graphic mode.

How useful are these ttys and why are there so many? In my case, Fedora is already "booted" in tty2 and in tty1 there is another graphical mode to login, is there any purpose in this or is it just a default to be initialized in this tty2 (have I never noticed this in other distros)?

    
asked by anonymous 25.02.2016 / 05:25

1 answer

4
  

How useful are these ttys and why are there so many?

The tty ( T it TY eg Writer ) is a driver that connects a device (eg keyboard, modem, printer) to the core of the operating system.

It is used, for example, so that more users can use the same CPU or to control tasks .

Through a terminal you can control other processes (eg change the priority, state, or "kill" a process) that are using other terminals.

The example mentioned in the question is a process control:

  

... when graphical mode hangs and need to restart gnome ...

The graphic mode (usually connected to tty7 ) "locked" and through another terminal, you can eliminate or restart this process.

The number of 6 text terminals ( tty1 to tty6 ) has been set and has no fixed ratio.

Despite the low memory consumption of the tty driver (eg from 8kb to 48kb per terminal), you can change the number of physical terminals in the inittab or ttys ( it is necessary to consult the documentation, as it depends on the operating system).

Before changing, it is recommended that you back up your system.

Example of an excerpt from inittab file for a Debian system:

# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
#  <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6

# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100

# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

Historical and technical references:

The demystified TTY

POSIX terminal interface

Linux Internals - Simone Demblon & Sebastian Spitzner - Terminal Emulation

Computer terminal explained

The Terminal and Job Control

The Evolution of the Unix Time-Sharing System

Seventh Edition Unix terminal interface

Origins and History of Unix, 1969-1995

    
25.02.2016 / 12:17