Pcornel
Linux · Linux Fundamentals

Terminal / TTY

Cheat sheet · https://pcornel.dk/topic.php?topic=2655

Back to the Topic

Answer

A terminal (TTY) is the device a shell reads from and writes to: physical consoles (/dev/tty1), serial lines (/dev/ttyS0) and pseudo-terminals for SSH and terminal windows (/dev/pts/N). It handles line editing, signals such as Ctrl+C and window size.

Remember

reset fixes a terminal left in a bad mode. Programs run without a TTY (cron, ssh host cmd) cannot prompt for passwords — use ssh -t to force one. Ctrl+C sends SIGINT, Ctrl+Z SIGTSTP, Ctrl+D end-of-input.

First checks

  • tty — the terminal device of this shell
  • who — logged-in users and their TTYs
  • stty -a — terminal settings
  • reset — restore a broken terminal

Commands

sudo

Verify in this order

terminal device opened → shell attached → line discipline handles input and signals → program reads and writes

Where it usually breaks

First mismatch in persistent intent → provider/parser/generator → kernel/userspace runtime → dependency/security context → logs/counters → consumer-visible read-back; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2655

Confirmation

Confirm action

Continue?