Print the filename of the terminal connected to standard input
tty [option] ...
-s, --silent, --quiet Do not print anything, only return the exit status.
--help Display help information and exit.
--version Display version information and exit.
When using -s, --silent, --quiet, a return code of 0 indicates standard input is a terminal, 1 indicates it is not, 2 indicates an option error, and 3 indicates a write error occurred.
Display the terminal device filename connected to current standard input.
[root@localhost ~]# tty
/dev/pts/2
Find the processes associated with the terminal (assuming it's pts/2):
# Note the filtering for the TTY column.
ps -ef | egrep "pts/2 " | grep -v grep
GNU coreutils package. For more help, see man -s 1 tty or info coreutils 'tty invocation'.