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.

Log in or register to write something here or to contact authors.