During the pre-internet days of Unix, what we see on a computer screen today, a terminal was an electronic or electromechanical hardware-based device like electromechanical teleprinters or teletypewriters (TeleTYpewriter abbreviated as TTY). The teletype was a name for the old paper printing terminals that were plugged into the mainframe computers at that time.

These devices/terminals/teletypes were used as a medium to enter and display data from a computer device. Computers were connected to these devices/terminals/teletypes via serial links. These terminals were big. There was an exact number corresponding to each teletype and referred to by its device file, such as /dev/ttyN. The system would read this file to interpret what is entered from the teletype and write to the same file to print for that teletype. An example of such a device is the Teletype Model 33 ASR.

The ASR-33 teletype was a standard interactive device at that time. It was noisy and a little slow to print on large yellow-colored papers in uppercase format only.

With technological advancement, video display terminals took over the teletype terminals. DEC VT100 terminal, introduced in 1978, was one such example of a video display terminal. It was not a computer but a device for inputting and retrieving data from a connected computer.

Many variants were later introduced, such as VT101, VT102, and VT200 series terminals that replaced the VT100. These terminals, however, did not keep up with the modern computing environment. Thus, terminal emulation programs were introduced to impersonate these hardware-based terminals.

Classifying the TTY devices

TTY devices or teletype devices are character-based devices. TTY devices can be classified into three types:

  1. Serial devices: They are used with serial connections like over a modem, telephone, or over a serial cable.
  2. Virtual terminals: They are used for creating normal console connections, for example, the consoles that are accessible by pressing “Ctrl Alt Fn” (for n between 1 and 6).
  3. Pseudo terminals: They set up bi-directional communication utilized by several higher-end applications, e.g., X11. The graphical terminal windows we see on screen are not teletype in the real sense. The “pseudo-terminal service”, or “pts” in short, manages those terminal windows.

Serial TTY devices got their name because the actual character-based terminals were attached to a Unix system using a serial cable. The virtual terminals and pseudo terminals were called TTY devices because they behave like the serial devices from the programmer’s perspective.

Looking for “TTY” on Linux

There are many teletypes defined on modern Linux systems. To list different TTY devices, run the following command:

$ ls -l /dev | grep ‘tty’

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/02/echo/The-Definition-and-Its-Uses-1.png" data-lazy- height="290" src="data:image/svg xml,” width=”737″>

Perhaps you might not have seen the TTY numbered above 6, but as you can see from the previous command, there are many strange tty like tty40, tty27, and so on. The ttys from 1 to 6 can be accessed by pressing “Ctrl Alt Fn” (for n between 1 and 6). When you choose any of these combinations, you will land on a plain text interface having an independent text-based login interface. To get back to the graphical interface, press “Ctrl Alt F7”.

The teletype “tty2” is associated with [Ctrl] [Alt] [F2], “tty3” is attached to [Ctrl] [Alt] [F3] and so on till F6. The teletype (tty7) is reserved for the graphical interface, which is handled by a program “gnome-session”. Thus, when we press [Ctrl] [Alt] [F7], we revert to the graphical environment. This worked on Kali Linux. But in the case of the Ubuntu system, you may need to enter “Ctrl Alt F2”, depending on the operating system.

The list of the active TTY devices can be viewed in the “drivers” file:

<img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/02/echo/The-Definition-and-Its-Uses-2.png" data-lazy- height="267" src="data:image/svg xml,” width=”679″>

General Terminal Terminologies

Now that we have seen a bit about the historical significance and general introduction of teletype or TTY devices, it seems a good idea to write a few words about general terms related to Terminals.

Shell: It is a command-line interpreter for Linux and serves as an interface or medium between a user and the kernel. One can develop their own shell. The most used shell programs are Bourne shell, C shell, Korn shell, etc.

Bash, zsh, csh: These are all types of shells. Many commands are common and have similar syntax. One can easily switch between these shells after installing them.

Terminal: It is a software for interacting with the shell by executing the commands/scripts, displaying the outputs, etc.

How to Use the tty Command

  1. Open a terminal by pressing “Ctrl Alt t” and check your OS’s shell provided to you. Use the following command:

    <img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/02/echo/The-Definition-and-Its-Uses-3.png" data-lazy- height="113" src="data:image/svg xml,” width=”799″>

  2. As you can see from the output, the current shell is “bash”. This is the default shell for your system.

  3. When we run the tty command without any option, it outputs the filename of the terminal attached to standard input:

    <img alt="" data-lazy- data-lazy-src="https://kirelos.com/wp-content/uploads/2022/02/echo/The-Definition-and-Its-Uses-4.png" data-lazy- height="122" src="data:image/svg xml,” width=”729″>

The “/dev” directory holds the entries for file systems representing different devices connected to your system. The “-s” option returns the exit status, and with the “—help” option, one can view the help message.

Conclusion

Computers have evolved and so did the terminals and other related stuff. Teletypes, the old giant hardware-based terminals, are still an integral part of a computing system but now in a software-based emulator program. We hope you found this article helpful. Check out other Linux Hint articles for more tips and tutorials.

About the author

<img data-del="avatar" data-lazy-src="https://kirelos.com/wp-content/uploads/2022/02/echo/IMG_20201123_090644_2-150×150.jpg" height="112" src="data:image/svg xml,” width=”112″>

Ali Imran Nagori

Ali imran is a technical writer and Linux enthusiast who loves to write about Linux system administration and related technologies. You can connect with him on LinkedIn


.