December 2002
Intermediate to advanced
1616 pages
39h 57m
English
Displays the terminal pathname
tty [option]
The tty utility displays the pathname of standard input if it is a terminal and displays not a tty if it is not. The exit status is 0 if standard input is a terminal and 1 if it is not.
There are no arguments.
--silent or --quiet
-s Causes tty not to print anything. The exit status of tty is still set, however.
The term tty is short for teletypewriter, the terminal device that UNIX was first run from. This command appears in UNIX, and GNU/Linux has kept it for the sake of consistency and tradition.
The following example illustrates the use of tty:
$ tty /dev/tty11 $ echo $? 0 $ tty < memo not a tty $ echo $? 1
Read now
Unlock full access