Understanding /dev/tty, /dev/tty0, and /dev/console in Linux
This article explains the distinct roles of the Linux special device files /dev/tty, /dev/tty0, and /dev/console, showing how each maps to the current terminal, the graphical virtual console, and the kernel boot console respectively, with command examples and usage details.
/dev/tty
ls -l tty
crw-rw-rw- 1 root tty 5, 0 May 8 09:32 tty/dev/tty represents the controlling terminal of the current process. It dynamically points to the active console device (such as tty1, tty2, etc.), allowing the process to perform input and output on that terminal.
/dev/tty0
ls -l tty0
crw-rw-rw- 1 root tty 5, 0 May 8 09:32 tty0/dev/tty0 is the virtual console device used by the graphical environment. When Linux boots, each virtual console receives a device file (tty1, tty2, …). /dev/tty0 refers to the primary graphical console; opening it switches to the newly opened virtual terminal.
/dev/console
ls -l console
crw------- 1 root root 5, 1 May 8 09:32 console/dev/console is the system console used by the kernel during boot. All kernel output is sent to this device until the boot process finishes, after which it stops outputting. Boot‑time logs can be examined via /var/log/messages or the journalctl command.
In summary, /dev/tty points to the current active terminal, /dev/tty0 denotes the graphical virtual console, and /dev/console is primarily for kernel messages during system startup. While their functions differ, /dev/tty and /dev/tty0 are closely related as both represent console devices.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
