Can someone explain me what are the tty files? I can't understand that, using the command : echo 1 > /dev/tty prints to my current terminal the output: 1, but if i try to use echo 1 > /dev/tty0 or echo 1 > /dev/tty1 nothing happens. So i understand that /dev/tty represents my actual terminal but the other 61 tty what are represents? And how i can use them?

NB: i'm connected to a linux server by ssh and i have already understood how works /dev/pts.

2 Answers 2


They correspond to each individual terminal device on the system, either real or virtual. /dev/tty itself is special and points to the terminal of the process accessing it.

The /dev/tty<number> ones are the Linux text-mode virtual consoles, which you can usually get to from X with Ctrl-Alt-F1 etc. (Your GUI is probably at F6 or F8 or so.) /dev/ttyS<number> are serial ports, and terminal emulators (xterm, GNOME Terminal, or whatever), along with SSH sessions and windows in GNU screen or tmux usually appear as /dev/pts/<number>.

Writing to each writes to the corresponding terminal, it's easiest to test that by starting a few terminal emulators and running the tty command on each to see which tty they are connected to.

  • So i'm connected to my linux server by ssh, if i execute the command tty the output is: /dev/pts/0, but if i try to execute the command chvt <number> to change the tty it don't work. In this case, what are tty folders and what functionality do they have in this case? NB i'm using mac so the command ctrl-alt-f1 does not work. Commented Jan 6, 2022 at 7:39
  • Last question: why we have 62 tty files but we can just use 7 of those? Commented Jan 6, 2022 at 8:20

Simply list /dev/tty* using ls -ls and consider the owner of each of these special files as well as their associated access rights.

Normally, none of them should be displayed with user w rights.

Hence standard users will only be capable of writing to the special files they own.

On a desktop, only a small number of these 64 character devices will actually get mapped to existing consoles.

Anyway, what would you like to do with them apart from inputting from associated keyboards or writing to their screens ?

  • for now i understood that tty* is like a virtual terminal that i can connected, but how ? I have 62 tty files, if i want to connect for example at the tty30 how i can do this and what is the utility of have 62 tty files? NB i'm using a mac book connected to a linux server by ssh Commented Jan 6, 2022 at 8:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .