Do /dev/tty and current /dev/pts/X are the same things?

0

Writing file to /dev/tty and /dev/pts/7 in this case results that it is printed in console:

$ echo hello > file.txt
$ cp file.txt /dev/tty
hello
$ tty
/dev/pts/7
$ cp file.txt /dev/pts/7
hello

Do these two files are synonyms in this case?

scdmb

Posted 2014-03-25T18:46:26.730

Reputation: 821

Answers

1

Yes, they act identically. /dev/tty is a special character device that resembles your "current terminal". This is for convenience, so that you don't have to look what your actual terminal is when needed but just can open /dev/tty, independent whether it's /dev/pts/5 or /dev/pty7 or /dev/tty3.

Andreas Wiese

Posted 2014-03-25T18:46:26.730

Reputation: 1 911