Raj*_*pui 2 terminal shell kill
我登录到一台机器,然后输入:
insite1@POC-Messaging1:/opt/insiteone/log> last -a | grep "logged"
insite1 pts/6 Tue Jul 30 03:59 still logged in 160.110.5.210
root pts/5 Tue Jul 30 02:28 still logged in 160.110.154.231
root pts/4 Tue Jul 30 02:26 still logged in 160.110.154.231
root pts/0 Tue Jul 30 02:18 still logged in 160.110.5.210
root pts/3 Tue Jul 30 02:13 still logged in 160.110.5.210
root pts/2 Tue Jul 30 01:00 still logged in 160.110.154.231
root pts/1 Tue Jul 30 00:47 still logged in 160.110.154.231
Run Code Online (Sandbox Code Playgroud)
我想杀死除了从 160.110.5.210 登录的用户之外的其他人。怎么做?
终止终端登录会话的最简洁方法是向所有进程 \xe2\x80\x93 发送 SIGHUP “挂起”信号,该信号也会在关闭终端窗口或 SSH 连接时发送。
\n\npkill -HUP -t pts/1\nRun Code Online (Sandbox Code Playgroud)\n\n使用pgreporpkill比 更容易ps|grep|grep|grep|grep|grep|grep。
如果你想编写这样的脚本:
\n\nfor tty in $(who | awk \'$1 == "root" {print $2}\'); do\n test $tty = ${thistty=$(tty)} || pkill -HUP -t $tty\ndone\nRun Code Online (Sandbox Code Playgroud)\n