/dev/tty

(thing) by jt Mon Nov 27 2000 at 15:25:12

A device on any Unix system which is connected to the controlling terminal (if it exists) of the process open(2)ing it. Of course, in most cases simply writing to standard output does exactly the same thing; however, /dev/tty can be useful on occasions, such as when file descriptor redirection has occurred so that no currently open file references the terminal. Example:

	grep jason /etc/passwd | tee /dev/tty | sort -t: +2n >file

This will list all occurrences of jason in the /etc/passwd file on the terminal, and leave a UID-sorted list in file.

Y'know, if you log in, you can write something here, or contact authors directly on the site. Create a New User if you don't already have an account.