Linux下快速清除终端进程

这几天刚将windows 10 升级到1909版本,目的是为了学习一下wsl2 及 ubuntu;
在ubuntu的官方教程中,有这么一段话:

Be sure to check for any established SSH connections by the disabled user, as it is possible they may have existing inbound or outbound connections. Kill any that are found.

当禁用一个用户后,其仍可以通过已授权的ssh authentication进行ssh连接,所以还需要确认是不是有这样的连接存在并清除掉;

看到这段文字后,我赶紧看了一下我的VPS;

ttyS0应该是通过VPS后台的终端进行连接的,居然还残留在里面;

在清除之前,简短描述一下TTYP

The word tty stands for teletype terminals. Some years ago, user terminals were connected to computers’ electromechanical teleprinters or teletypewriters (TeleTYpewriter, TTY), since then the name TTY has continued to be used as the name for the text-only console.

TTY是电传打字机的缩写,以前呢都是通过电传打字机与计算机进行信息交流的;至此,TTY即作为文字终端延用下来了;

回到问题上来,怎么清除掉这个终端进程呢?

 pkill -kill -t ttyS0 

还可以在清除之前,看一下这个连接在执行哪些进程:

 ps -ft ttyS0 

最后,怎么查看当前连接的会话信息?

 tty 

完!

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注