图像

Linux踢出用户命令(pkill bash)

pkill 用法如下,英文要nice:

jerry@debian:~$ pkill --help

Usage:
 pkill [options] <pattern>

Options:
 -<sig>, --signal <sig>    signal to send (either number or name)
 -e, --echo                display what is killed
 -f, --full                use full process name to match
 -g, --pgroup <id,...>     match listed process group IDs
 -G, --group <gid,...>     match real group IDs
 -n, --newest              select most recently started
 -o, --oldest              select least recently started
 -P, --parent <ppid,...>   match only childs of given parent
 -s, --session <sid,...>   match session IDs
 -t, --terminal <tty,...>  match by controlling terminal
 -u, --euid <id,...>       match by effective IDs
 -U, --uid <id,...>        match by real IDs
 -x, --exact               match exectly with command name
 -F, --pidfile <file>      read PIDs from file
 -L, --logpidfile          fail if PID file is not locked

 -h, --help     display this help and exit
 -V, --version  output version information and exit

常用操作如下:

1. 将某个终端的用户踢出

pkill -kill -t pts/2

pts/2 表示 终端号
2. 按用户名踢出用户

pkill -kill -U test

test 表示 系统用户名

发表评论