TTY: The Definition and Its Uses

The TTY is the abbreviation of Teletypewriters. This device was used as a medium for entering data from computer devices in prehistoric days. Computers are linked with each other to these devices through serial links. The data was stored in the device file, such as /dev/ttyN then the data was printed from this file. An example that can be considered for this device is Teletype Model 33 ASR, a standard interactive device currently.

This article will demonstrate the usage of TTY (Teletypewriters) devices. The content for the post is:

What are the Types of TTY Devices?

It is a character-based device with three types:

  • Serial Devices
  • Virtual Terminals
  • Pseudo Terminals

Serial Devices

In these devices, a serial connection is used over the telephone or modem.

Virtual Terminals

These devices generate console connections, such as a console that is accessed by pressing the shortcut keys.

Pseudo Terminals

It is set up for bidirectional communication by high-level applications such as X11. The window screen is managed by the “pseudo-terminal services”.

Note: The serial Devices have their name as the character-based device is connected to the Unix or Linux Operating system using a cable. The pseudo and virtual terminals are known as TTY devices because of their behavior which is the same as the serial devices.

How to Search For TTY on Linux?

To search for the devices in Linux, run the below command in the terminal:

$ ls -l /dev | grep 'tty'

All the tty devices will be listed, but you have noticed many numbers above 6 for tty devices (0, 10, 11…..). The first 6 tty devices (between 1 and 6) are accessible by pressing the shortcut keys (Ctrl+Alt+F1, Ctrl+Alt+F2………Ctrl+Alt+F6).

To list the active tty devices in the Linux operating system, view the “drivers” file in the “/proc/tty/drivers” directory. To do this, execute the following command:

$ cat /proc/tty/drivers

All the active tty devices have been listed.

What are the Modern Terminal Technologies?

There are many modern terminal technologies, such as shells; a shell is a command-line interpreter medium between the user and the Kernel. The most popular shells are bash, zsh, C, Korn Shells, etc. Most utilities are common and have the same syntax in these shells.

How is the tty Command used in Linux?

The bash is the default shell of the Linux operating system that can be checked using the given command:

$ echo "$SHELL"

The above images show that the bash shell is the current shell.

To use the tty utility, type it in the terminal and press enter, It will display the outputs of the file name of the standard input devices:

$ tty

The “/dev” directory stores the entries for the tty devices connected to the operating system.

Conclusion

The TTY is a character-based device used as a medium for entering data, still a crucial part of the operating systems but in software form. TTY devices are of three types: serial, virtual, and pseudo terminals. The /dev file stores the entries for the TTY-connected devices. Users can view all the active tty devices in the “/proc/tty/drivers” directory. This write-up has briefly illustrated TTY devices and their uses.