The system is centos 7 x64 running at level 3 mode which is no GUI. I am connecting remotely to the machine. I use tmate and teamviewer. I run who and I can view who is login on ttys.usera tty1     2017-02-24 11:47userb tty2     2017-02-24 12:00userc tty6     2017-02-24 02:00The result is same in tmate session and teamviewer session. But when I type tty. tmate session returns /dev/pts/1 while teamviewer return /dev/tty6. It seems teamviewer returns tty number which is same with terminal number opened by Ctrl-Shift-Fn, and here is Ctrl-Alt-F6.I have read several article which describes tty and pty. what-is-the-exact-difference-between-a-terminal-a-shell-a-tty-and-a-con, difference-between-pts-and-ttyWhat I would like to do is that how to get current tty number from pty session? In my specific case, I want to get tty number in tmate session. So which tty does pts running on? In the case above tmate is started on teamviewer session. so I type tty get /dev/pts/1 and then I exit tmate session by typing exit and back to teamviewer session and type tty again get /dev/tty6. It seems means that /dev/pts/1 working on /dev/tty6. And I want to get tty6 in tmate session without exit to the session. It should nothing related to tmate and teamviewer. It should same when ssh to a physic machine. So there should a solution to get tty number back in pty.Manay solutions how-to-get-the-tty-in-which-bash-is-running, returns the filename of the terminal connected to standard input, get-current-terminal-name only get pty number. But I would like to get tty number.How to do that? Thanks.
how to get tty from current pts
centos;tty;pty