linux获取当前pts


获取当前pts [root@192_168_1_165 ~]# echo $SSH_TTY /dev/pts/3 [root@192_168_1_165 ~]# env | grep pts SSH_TTY=/dev/pts/3 检测指定pts的运行程序 [root@192_168_1_165 luting]# ps -ef | grep tailf | grep -v grep | grep pts/3  root 15683 13858 0 14:17 pts/3 00:00:00 tailf test1.py
检测当前pts运行程序 ps -ef | grep tailf | grep -v grep | grep pts/`echo $SSH_TTY | awk -F'/' '{print $4}'` 杀死指定pts

ps -ef | grep tailf | grep -v grep | grep pts/3 | xargs kill -9