tty - Returns pathname of terminal device
command writes the full pathname of your
terminal device to standard output. The
also be used to determine if standard input is a terminal.
Interfaces documented on this reference page conform to industry standards as follows:
tty: XPG4, XPG4-UNIX
Refer to the
reference page for more information
about industry standards and associated tags.
Suppresses reporting the pathname.
The command tty -s evaluates as TRUE if standard input is a display and FALSE if it is not.
[Compaq] The file
is a special file always
refers to your controlling terminal, although it also may have another name
To avoid writing undesirable output to an output file--for example,
to write a prompt in a shell script to the screen, while writing the response
to the prompt to an output file--redirect standard output to
option is useful if only the exit code
is wanted, it does not rely on any ability to form a valid pathname. For a
portable application you should use the command
The following exit values are returned:
Standard input is not a display.
[Compaq] Invalid options specified.
[Compaq] An error occurred.
[Compaq] Your standard input is not a display and you did
not specify the
To display full pathname of your terminal device, enter:
To test whether or not the standard input is a terminal device,
create a shell script containing the following:
if tty -s
echo 'Output is a display'
else echo 'Output is not a display'
The following environment variables affect the execution of
Provides a default value for the internationalization variables
that are unset or null. If
is unset or null, the corresponding value from the default locale is used.
If any of the internationalization variables contain an invalid setting, the
utility behaves as if none of the variables had been defined.
If set to a non-empty string value, overrides the values of
all the other internationalization variables.
Determines the locale for the interpretation of sequences
of bytes of text data as characters (for example, single-byte as opposed to
multibyte characters in arguments).
Determines the locale for the format and contents of diagnostic
messages written to standard error.
Determines the location of message catalogues for the processing
Pseudodevice representing the user's controlling terminal.
Commands: stty(1), test(1)