User Commands tty(1) NAME tty - return user's terminal name SYNOPSIS /usr/bin/tty /usr/bin/tty [ options ] ksh93 tty [ options ] DESCRIPTION tty writes the name of the terminal that is connected to not a standard input onto standard output. If the standard input is terminal, "not a tty" will be written to standard output. OPTIONS The following options are supported: -l, --line-number Write the synchronous line number of the terminal on a separate line following the terminal name line. If the standard input is not a synchronous terminal then "not on an active synchronous line" is written. -s, --silent|quiet Disable the terminal name line. Portable applications should use test -t 0 or [[ -t 0 ]] instead. ENVIRONMENT VARIABLES See environ(5) for descriptions of the following environment variables that affect the execution of tty: LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. EXIT STATUS The following exit values are returned: 0 Standard input is a tty. 1 Standard input is not a tty. 2 Invalid arguments. >=3 A an error occurred. ATTRIBUTES See attributes(5) for descriptions of the following attributes: ___________________________________________________________ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | |_____________________________|____________________________| | Availability | SUNWcsu | |_____________________________|____________________________| | CSI | enabled | |_____________________________|____________________________| | Interface Stability | Commited | |_____________________________|____________________________| This command conforms to IEEE Std 1003.1-2008. SEE ALSO ksh93(1), test(1), isatty(3C), ttyname(3C), attributes(5), environ(5), standards(5), http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html DIAGNOSTICS not on an active synchronous line The standard input is not a synchronous terminal and -l is specified. not a tty The standard input is not a terminal and -s is not specified. NOTES The -s option is useful only if the exit status is wanted. It does not rely on the ability to form a valid path name. Portable applications should use test -t or [[ -t 0 ]]. SunOS 5.10 Last change: 1 Feb 1995 2