Linux查看當前登錄用戶并踢出用戶的命令
更新時間:2018年05月05日 16:40:25 作者:瀟瀟、寒
這篇文章主要介紹了Linux查看當前登錄用戶并踢出用戶的命令,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
1、查看當前登錄用戶
[wilsh@lcl ~]$ whatis w w (1) - Show who is logged on and what they are doing [wilsh@lcl ~]$ w 09:49:30 up 1 day, 17:19, 4 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty3 - 09:25 23:25 0.10s 0.08s -bash root pts/0 192.168.105.188 09:32 9:38 0.02s 0.02s -bash root pts/1 192.168.105.188 09:36 9:32 0.03s 0.02s -bash wilsh pts/2 192.168.105.188 09:41 0.00s 0.00s 0.00s w
2、踢出當前在線的用戶
a)pkill
[wilsh@lcl ~]$ whatis pkill pkill [pgrep] (1) - look up or signal processes based on name and other attributes [wilsh@lcl ~]$ pkill -KILL -u wilsh #-u用來指定用戶名 [wilsh@lcl ~]$ pkill -9 -u wilsh # -KILL -9都是可以的。 [wilsh@lcl ~]$ pkill -KILL -t pts/2 [wilsh@lcl ~]$ pkill -KILL -t /dev/pts/2 # 這種寫法是錯誤的。因為在man page中明確說明,如果要使用-t參數(shù),那么就不能帶/dev/前輟。<span style="color:#FF99FF;"><span style="background-color: rgb(255, 255, 153);">#在centos6.7 kernel 3.10.28中測試,發(fā)現(xiàn)寫完整的設備名并不起作用(如/dev/pts/2),本文是在kernel 2.6.32中寫的,昨天晚上剛剛重啟編譯完3.10.28的內(nèi)核,測試了一下又不可以了,郁悶。</span></span>
b)skill
[wilsh@lcl ~]$ whatis skill skill (1) - send a signal or report process status [wilsh@lcl ~]$ skill -9 -t pts/2 [wilsh@lcl ~]$ w 09:57:37 up 1 day, 17:28, 4 users, load average: 0.00, 0.00, 0.00 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT root tty3 - 09:25 31:32 0.10s 0.08s -bash root pts/0 192.168.105.188 09:32 17:45 0.02s 0.02s -bash root pts/1 192.168.105.188 09:36 17:39 0.01s 0.01s -bash wilsh pts/2 192.168.105.188 09:57 0.00s 0.00s 0.00s w [wilsh@lcl ~]$ skill -9 -u wilsh
總結(jié)
以上所述是小編給大家介紹的Linux查看當前登錄用戶并踢出用戶的命令,希望對大家有所幫助,如果大家有任何疑問歡迎給我留言,小編會及時回復大家的!
相關文章
Ubuntu18.04下解決Qt出現(xiàn)qt.qpa.plugin:Could not load the Qt platfo
這篇文章主要介紹了Ubuntu18.04下解決Qt出現(xiàn)qt.qpa.plugin:Could not load the Qt platform plugin “xcb“問題,本文給大家分享解決方案,需要的朋友可以參考下2020-08-08Windows系統(tǒng)下Apache服務器無法啟動的問題解決
這篇文章主要介紹了Windows系統(tǒng)下Apache服務器無法啟動的問題解決,大多數(shù)情況下還是端口被占用的問題,需要的朋友可以參考下2015-07-07