O'Reilly logo

A Practical Guide to Red Hat® Linux® 8 by Mark G. Sobell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

tty

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.

Arguments

There are no arguments.

Options

--silent or --quiet

-s Causes tty not to print anything. The exit status of tty is still set, however.

Notes

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.

Example

The following example illustrates the use of tty:

$ tty 
/dev/tty11
$ echo $?
0
$ tty < memo
not a tty
$ echo $?
1

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required