Return the user's terminal name (POSIX)
tty [-s]
Neutrino
The tty utility writes to the standard output the name of the terminal that's open as standard input. If standard input isn't a terminal (e.g. it's a file such as /dev/null), the string not a tty is output instead.
The -s option is deprecated by POSIX; you can achieve the effect of this option, simply and portably, by redirecting output to /dev/null or by using the shell builtin, test -c. |
The following command prints /dev/con1 if run on console 1:
tty
The following command prints not a tty because /dev/null causes isatty() to return 0:
tty </dev/null