小陆同学

python 中文名:蟒蛇,设计者:Guido van Rossum

导航

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

posted on 2022-01-16 10:39  小陆同学  阅读(489)  评论(0编辑  收藏  举报