Text-Terminals on Linux

The 'getty' command initializes a terminal session

getty command in linux

In Linux and Unix, getty initializes terminal sessions. In most cases, people who use Linux for normal daily desktop work won't execute this command.

Why 'getty' Works as It Does

In the very early days of Unix, people interacted with the computer through keyboards and text-based interfaces — no mice and no graphical user interfaces. At the time, a teletypewriter transmitted information electronically. These TTYs served as a logic model for computer-user interaction in Unix, and that approach persists in modern Linux distributions. TTYs may be physical keyboard-and-monitor setups or virtual. All Linux distribution supports virtual terminals.

In Linux, a TTY is the behind-the-scenes pipeline to the command interpreter. Modern TTYs — invoked through getty, or "get TTY" — often appear to people as a window for text input, but what it really does is initialize a specific physical or virtual terminal for an interactive session by running the login process.

Check the /dev folder to see all the recognized terminals — they take the form of /dev/tty00, with a number representing each distinct terminal.

ttys on a desktop

A terminal program serves as the visual front-end to the back-end terminal connection; the TTY operates the same way no matter which terminal program you use, so when you wish to access a text-based command environment, you run the terminal program rather than directly asserting getty.

The TTY and the terminal program, in turn, don't really care about the shell — which is the logic model of how you enter commands into the text-based environment. Common shells include Bash, Ash, and Zsh.

Working With 'getty'

To access a TTY, just run your terminal program. That program serves as the user interface between the terminal back-end, the login process, the shell, and the user.

Only experienced system administrators should run getty directly, because the use case for running getty instead of a terminal window relate to system troubleshooting or custom getty behavior based on modifications to which specific physical or virtual terminal is invoked and according to what rules (as per customizations to the gettytab table).