Photo by PJH on Unsplash

On this page

This chapter follows Networking on Linux.

Pressing Enter in GNOME Terminal does not talk to the kernel directly. A terminal emulator speaks to a pseudo-terminal (PTY); a shell reads lines and launches programs. Debian defaults matter: /bin/sh is often dash for scripts, while interactive login may use bash. Script syntax and pipelines are in Shellscripting with Bash; object pipelines on Windows are in PowerShell.

TTYs and virtual consoles

A TTY (teletypewriter) is a kernel line discipline on a character device. Virtual consoles (Ctrl+Alt+F1–F6 on many installs) are full-screen TTYs outside the graphical session; F7 or later may switch back to the display manager.

Terminal window
tty
who
loginctl list-sessions

systemd manages getty@ services that spawn login prompts on each TTY. Serial consoles on servers use the same getty pattern on ttyS0.

PTYs and terminal emulators

Pseudo-terminals pair a master (emulator side) and slave (shell side). /dev/pts/ holds slave nodes; script and ssh -t allocate PTYs for sessions.

Terminal emulators (GNOME Terminal, Konsole, Alacritty) render fonts and handle paste, scrollback, and Unicode— they are not shells. tmux and screen multiplex one PTY into many panes while preserving a remote session.

Login shells, interactive shells, and startup files

A login shell starts with - prefix (bash -l); interactive shells attach to a TTY. Debian reads different files:

Context bash often reads
Login /etc/profile, ~/.profile, maybe ~/.bash_profile
Interactive non-login ~/.bashrc (often sourced from profile on Debian)

/bin/sh on Debian follows POSIX dash rules—no bash arrays or [[ ]]. Package maintainer scripts must use #!/bin/sh portability.

Environment variables (PATH, LANG) propagate to child processes—see Processes and inter-process communication for inheritance across fork.

Job control and signals

Interactive shells manage jobs (foreground/background), SIGTSTP, and SIGCONT. Job control requires a controlling TTY—why ssh command & behaves differently from an interactive ssh.

This is OS session mechanics; Bash-specific job syntax lives in the Bash article.

Choosing a shell

Shell Typical role on Debian
dash /bin/sh, fast POSIX scripts
bash Default interactive user shell
zsh, fish Optional, richer interactive UX

Change default shell with chsh (PAM-backed). Do not replace /bin/sh with bash on Debian—it breaks maintainer script assumptions.

Graphical sessions stack above TTYs: Graphical desktops on Linux covers Wayland, compositors, and desktop environments.

The next chapter is Graphical desktops on Linux.

Check your understanding

Question 1 of 5

0 of 5 checked

  1. 1. What service pattern spawns login prompts on TTYs according to the article?

Search articles

Type a word to search published articles.

Open the search page