Manual / tty
tty(1)
| TTY(1) | General Commands Manual | TTY(1) |
NAME
tty - print the terminal attached to standard input
SYNOPSIS
tty
DESCRIPTION
Tty writes the name of the terminal attached to standard input, one of /dev/tty1 through /dev/tty4 (the four consoles) or /dev/ttya0 (the Super Serial Card line). If standard input is not a terminal, tty writes not a tty instead. There are no operands; one given is a usage error, exit status 2.
FILES
/usr/man/TTY this page
SEE ALSO
DIAGNOSTICS
Exit status is 0 if standard input is a terminal, 1 if it is not, 2 if standard input's file descriptor could not be inspected at all (closed, or out of range).
BUGS
/dev/null is a device by this system's own buffering rules but is not a terminal by any Unix's definition, so tty reports it as not a tty, narrower than the isatty test some other maux code uses for buffering decisions alone. The historical -s option (silence the name, keep only the exit status) is not implemented -- POSIX.1-2024 itself removed it as obsolescent.
| September 14, 2026 | maux |