TTY Command – UNIX

TTY Command UNIX


tty print the file name of the terminal connected to standard input

tty command helps the user to identify whether the output for the shell script is a terminal or some other destination such as any other script or printer.


Following options can be used with the tty command:

-s, –silent, –quiet print nothing, only return an exit status
–help display this help and exit
–version output version information and exit


Example 1:

If user wants to check which terminal they are using.

$ tty


Example 2:

If someone wants to check the version of tty installed on the system:

$ tty –version

tty (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc..
License GPLv3+: GNU GPL version 3 or later <>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.