tty(4)
β¨ tty(4) β Kernel Interfaces Manual β¨
okay bestie, sit down, because we're talking about tty(4) β the little manpage with main character energy π
welcome to the Kernel Interfaces Manual, section 4, where the cool stuff lives.
π NAME π
tty β controlling terminal π₯οΈβ¨
πΈ DESCRIPTION πΈ
So. The file /dev/tty is a character file. Not like a character character, like a device file. It has major number 5 and minor number 0, and its mode is usually 0666 with ownership root:tty. It's literally a synonym for the controlling terminal of a process β if there is one. If there isn'tβ¦ well. That's a vibe check it might not pass π
On top of all the ioctl(2) requests that the device tty points at already supports, there's one extra request that gets supported here: TIOCNOTTY. she's special, your honor π
π« TIOCNOTTY π«
Basically: detach the calling process from its controlling terminal. bye bestie π
If the process is the session leader, then SIGHUP and SIGCONT signals get sent to the foreground process group, and all processes in the current session lose their controlling tty. not a drill π
careful with this one β it ripples out to the whole session when a session leader calls it, fr fr
Okay and super important: this ioctl(2) call works only on file descriptors connected to /dev/tty. Only. Just that one. no substitutes π«
So like, who even uses this? Daemon processes, when a user invokes them at a terminal. Here's the move they pull:
- The process attempts to open
/dev/ttyπ«Ά - If the open succeeds, it detaches itself from the terminal by using
TIOCNOTTYβοΈ - If the open fails, it is obviously not attached to a terminal and does not need to detach itself. no harm, no foul, no drama π
iconic honestly. ate and left no crumbs.
π FILES π
/dev/tty
π SEE ALSO π
chown(1)mknod(1)ioctl(2)ioctl_console(2)ioctl_tty(2)termios(7)ttyS(4)vcs(4)pty(7)agetty(8)mingetty(8)
and that's the whole page, bestie, no cap π this lil slice of the Linux man-pages 6.20 dropped on 2026-07-02, and you now know it through and through. periodt. π¦β¨
π¦ where this page comes from
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages 6.20
- π the page's license: GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms