From UNIX to Linux, you’ve heard the term “TTY”. As a desktop user, you should be using it and you use it a lot. In the tutorial, let me mention everything necessary to get you familiar with the term TTY in Linux. Please note that there is no clear answer to this, but it has to do with the way input/output devices used to interact. Therefore, you must know some history to get a clear understanding.

History of tty

It all started with the teletypewriter in the 1830s. The teletypewriter allowed you to send/receive text messages over the wire. It replaced Morse code communication, in which two operators were needed to effectively communicate with each other.

Moreover, a teletypewriter can easily communicate messages with only one operator. Although it did not have a modern layout keyboard, its system was later improved by Donald Murray in 1901 to include a typewriter-like keyboard.

The Murray code reduced the amount of work required by the operator to send a message. And, it made it possible for the teletypewriter to evolve into a commercial teletypewriter in 1908. tty is short for teletypewriter.

image

The modern concept of tty

Now, you must be wondering, how did it come to modern computing and Linux? First, when the teletypewriter entered the market, a few years later semiconductor transistors were developed, which then evolved into the microprocessor that made computers possible. The original computers had no concept of a keyboard. It was all punch card input.

image

With the development of computers, batch input cards were eventually replaced by teletypewriters as a convenient input/output device.

With advances in technology, teletypewriters “virtualize” the use of electronic devices. So, instead of a physical, mechanical TTY, you have a virtual electronic TTY.

Early computers didn’t even have video screens. Things were printed on paper rather than displayed on the screen. Therefore, you would see the term “print” used instead of “display”. As technology progressed, video terminals were later added to the terminals. You can also call them physical terminals. These then evolved into software emulation terminals with greater capabilities and functionality.

This is what you call a “terminal emulator”. For example, GNOME Terminal or Konsole are the best terminal emulators you can find for Linux.

TTY in Linux

Speaking of Linux, a TTY is an abstract device in UNIX and Linux. Sometimes it refers to a physical input device, such as the serial port USB, and sometimes it refers to a virtual TTY that allows the user to interact with the system (ref).

TTY is a subsystem in Linux and Unix that makes process management, line editing, and session management possible in the kernel via TTY drivers. In terms of programming, you will need to dig deeper. However, given the scope of this article, this may be an easily digestible definition. If you are curious, you can explore an old resource ( TTY Demystified ) that tries to clear up all the technical details in Linux and Unix systems for you to understand TTY.

In fact, whenever you start the terminal emulator or use any type of shell on your system, it interacts with a virtual TTY called pseudo-TTY or PTY. You can find the associated PTY by simply typing tty in the terminal emulator.

How to access TTY in Linux

Accessing TTY in Linux is easy. In fact, you access it all the time.

You can open TTY by using the following keyboard shortcuts on most distributions.

  • CTRL + ALT + F1 - lock screen
  • CTRL + ALT + F2 - Desktop environment
  • CTRL + ALT + F3 - TTY3
  • CTRL + ALT + F4 - TTY4
  • CTRL + ALT + F5 - TT5
  • CTRL + ALT + F6 - TTY6

You can access up to six TTYs in total, however, the first two shortcuts point to the distribution’s lock screen and desktop environment. Therefore, you will get the command line interface with the rest of the shortcuts.

When to use TTY in Linux

tty is more than just a technical treasure. It’s useful even for users like me who are not developers.

It should come in handy if the graphical desktop environment gets stuck. In some cases, reinstalling the desktop environment from TTY can help solve the problem. Or, you can choose to perform tasks in TTY, such as updating your Linux system, etc. Worst case scenario, if your GUI is not responding, you can go to TTY and restart your computer. Some users also like to perform large file transfers with the help of TTY.

tty is also a command in Linux

When you type TTY in the terminal emulator, it will print the filename of the terminal connected to the standard input, as described on the manual page.

In other words, to know the number of the TTY you are connected to, simply enter the TTY. and, if there are multiple users remotely connected to the Linux machine, you can use the who command to check which users the other TTYs are connected to