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:

  1. The process attempts to open /dev/tty 🫢
  2. If the open succeeds, it detaches itself from the terminal by using TIOCNOTTY βœ‚οΈ
  3. 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 πŸ‘€


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