Linux (UNIX in general) TTY/console demystified

Keywords: #driver #Linux #tty #unix

I don’t quite know how I know but I know very well how the Linux TTY/Console driver stack works… Probably through so many years of slogging through code, and through tearing apart the Linux TTY drivers and line discipline stacks a few times for special projects and definitely with some help of the LDD3 (a MUST read for anyone trying to go spelunking for the first time in the Linux Kernel Land – no, I don’t know if/when an update will be made but 99% of whats there is still up to date). They’re a deeply complicated group with many layers. And today I ran into a site (which I was browsing because of this Slashdot article on building the Chipophone) which documents and explains the most of Linux TTY system, including job control, very well. It even explains how your ^Z signals vi to stop and return control to the shell, what the shell does to regain control, etc. All sorts of good stuff. Anyone writing terminal mode, or headless, code for Linux or Unix-like environments should read this article. It explains pipes too, and how sessions and jobs relate.