HomeLinuxWhat Is /dev/tty, /dev/tty0, and /dev/console in Linux

What Is /dev/tty, /dev/tty0, and /dev/console in Linux


Linux / UNIX helps machine information which might be saved within the /dev listing. These aren’t precise information, quite, they’re particular information or character gadgets which might be consultant of {hardware} gadgets connected to the system.

Among the mostly misunderstood machine information are /dev/console, /dev/tty, and /dev/tty0. On this information, we are going to discover the nuances that distinguish these three machine information.

What’s /dev/tty in Linux

tty” is brief for TeleTYpewriter. It has its origin within the early terminals that had been used to connect with computer systems as teleprinters or teletypewriters.

The /dev/tty file is a particular file that represents the terminal for the present course of, which shows the terminal related to the present SSH session.

To test which tty you might be at present utilizing, run the next command:

$ tty
OR
$ who am i

The output reveals that the present tty is /dev/pts/0. This stands for Pseudo Terminal Slave and is a terminal machine emulated by SSH connections or different applications corresponding to xterm or display screen.

Check Current TTY in Linux
Examine Present TTY in Linux

What’s /dev/tty[0-N] in Linux

/dev/tty[0-N] is solely a digital console that you would be able to swap to from the primary terminal in case you are operating a GUI system the place N represents the TTY quantity. By default, /dev/tty0 is the default digital console.

For instance, in case you are operating a graphical occasion of Ubuntu 22.04, launch your terminal and sort CTRL + ALT + F1, which is able to open a black terminal display screen as proven beneath.

As you’ll be able to see, from the output, we’re utilizing tty1 the place 1 corresponds to the Perform Key pressed.

Linux Virtual Console
Linux Digital Console

tty1 by tty63 are digital terminals, alternatively referred to as VTs or digital consoles. And as talked about, they simulate a number of consoles on prime of the bodily console machine driver.

What’s /dev/console in Linux

/dev/console is known as the system console, the place the boot and kernel messages are displayed on this console throughout booting. Like different Linux machine information, it resides within the /dev listing.

You may affirm by operating the next ls command as follows.

$ ls -lah /dev/console
Linux System Console
Linux System Console

/dev/console exists primarily to reveal the kernel’s console to consumer area. It reveals messages throughout system startup (and shutdown as nicely) and in addition facilitates the switchover to single-user mode utilizing the init 1 command.

Conclusion

It’s our hope that you would be able to now choose the variations that exist throughout the three machine information that we have now simply lined. Your suggestions on this information is welcome.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments