Displays the file name of the terminal device connected to the current standard input.
tty [option] ...
-s, --silent, --quiet Do not print any information, 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 that standard input is a terminal, a return code of 1 indicates that standard input is not a terminal, a return code of 2 indicates an option error, and a return code of 3 indicates that there is A write error occurred.
Displays the file name of the terminal device connected to the current standard input.
[root@localhost ~]# tty
/dev/pts/2
Find the process associated with the terminal (assuming it is pts/2)
# Note that the TTY column is filtered.
ps -ef | egrep "pts/2 " | grep -v grep