tty/pts 相关指令
stty -F /dev/pts/2
ls /proc/29864/fd/* -l
strace -p 29864 |less
ls /proc/locks
ls /proc/locks -l
ls /proc/tty/drivers
cat /proc/tty/drivers
sudo fuser -v /dev/ptmx
do chkio /proc/29864/io /dev/pts/39
chkio /proc/29864/io /dev/pts/39
who
ps -t pts/39 --forest
man stty
stty -F /dev/pts/39
sudo fuser -v /dev/ptmx
ls /sys/class/tty/ptmx/subsystem/
ls /sys/class/tty/ptmx/subsystem/ -l
ls /sys/class/tty/ptmx/subsystem/ -l |grep pts
ls /sys/class/tty/ptmx/subsystem/
ls /sys/class/tty/ptmx/subsystem/
ls /sys/class/tty/ptmx/
ls /sys/class/tty/ptmx/dev
cat /sys/class/tty/ptmx/dev
sudo fuser -v /dev/ptmx
find / -name "pts/39"
How can we know who's at the other end of a pseudo-terminal device?
If I do a:
Some process will read that Is there a way to find out what that(those) process(es) is(are)? Or in other words, how could I find out which xterm/sshd/script/screen/tmux/expect/socat... is at the other end of
for each of the pid/fd returned by |
How can I figure out which pty's are from which qemu?
$ for i in `virsh list | awk '{print $2}' | egrep -v "^$|Name"`; do printf "%-14s:%s\n" $i $(virsh ttyconsole $i | grep -v "^$"); done cobbler :/dev/pts/1 xwiki :/dev/pts/3 fan :/dev/pts/4 mercury :/dev/pts/5 mungr :/dev/pts/0 win2008R2-01 :/dev/pts/7
Incidentally those same VMs through anlsof
command:
$ lsof|grep qemu|grep ptmx
qemu-kvm 3796 root 14u CHR 5,2 0t0 993 /dev/ptmx
qemu-kvm 3895 root 14u CHR 5,2 0t0 993 /dev/ptmx
qemu-kvm 3972 root 14u CHR 5,2 0t0 993 /dev/ptmx
qemu-kvm 4294 root 15u CHR 5,2 0t0 993 /dev/ptmx
qemu-kvm 11897 root 14u CHR 5,2 0t0 993 /dev/ptmx