On a Linux system, what is the difference between /dev/console , /dev/tty and /dev/tty0 ?!
From the documentation:
/dev/tty Current TTY device /dev/console System console /dev/tty0 Current virtual console
In the good old days
/dev/console was System Administrator console. And TTYs were users’ serial devices attached to a server. Now
/dev/tty0 represent current display and usually are the same. You can override it for example by adding
grub.conf. After that your
/dev/tty0 is a monitor and
An exercise to show the difference between
Switch to the 2nd console by pressing Ctrl+Alt+F2. Login as
sleep 5; echo tty0 > /dev/tty0. Press Enter and switch to the 3rd console by pressing Alt+F3. Now switch back to the 2nd console by pressing Alt+F2. Type
sleep 5; echo tty > /dev/tty, press Enter and switch to the 3rd console.
You can see that
tty is the console where process starts, and
tty0 is a always current console.