Linux 如何杀死终端

1、使用who命令查看当前有多少个终端登陆了Linux系统

[root@ceph120 ~]# who
root     pts/2        2020-12-03 22:08 (10.56.112.51)
root     pts/3        2020-12-04 15:58 (10.56.112.51)
root     pts/4        2020-12-04 09:56 (10.56.112.51)

2、使用tty查看自己当前所使用的终端

[root@ceph120 ~]# tty
/dev/pts/3

3、显示希望杀死的终端的进程号,希望杀死的登录终端是pts/4,得到对应的进程号是800990

[root@ceph120 ~]# ps -t /dev/pts/4
    PID TTY          TIME CMD
 800990 pts/4    00:00:00 bash

4、杀死相应的进程

[root@ceph120 rpm]# kill -9 800990

5、再使用who命令可以看到登录终端没有刚刚关闭的终端了

[root@ceph120 ~]# who
root     pts/2        2020-12-03 22:08 (10.56.112.51)
root     pts/3        2020-12-04 15:58 (10.56.112.51)
原文地址:https://www.cnblogs.com/fyusac/p/14086519.html