Linux 之 skill 命令
..note::
江山代有才人出,各领风骚数百年。
赵翼《论诗五首·其二》
Linux skill
命令送个讯号给正在执行的程序,预设的讯息为 TERM (中断),较常使用的讯息为 HUP、INT、KILL、STOP、CONT 和 0。
讯息有三种写法:分别为 -9、-SIGKILL、-KILL,可以使用 -l 或 -L 已列出可使用的讯息。
官方含义为:
skill, snice - send a signal or report process status
语法
1 | $ skill [signal] [options] expression |
一般参数:
-i
,--interactive
:交互模式,每个动作将要被确认-l
,--list
: 列出所有的信号-L
,--table
: 列出所有的信号名
列出所有的信号
1 | $ skill -l |
用漂亮的表格列出所有的信号
1 | $ skill -L |
kill掉用户users在PTY的进程
1 | $ skill -KILL -t /dev/pts/* |
停止三个使用者 user1、user2、user3
1 | $ skill -STOP -u user1 -u user2 -u user3 |
相关命令
- :ref:
kill<linux-beginner-kill>
- :ref:
killall<linux-beginner-killall>
- :ref:
nice<linux-beginner-nice>
- :ref:
pkill<linux-beginner-pkill>
- :ref:
renice<linux-beginner-renice>
- :ref:
signal<linux-beginner-signal>
OPTIONS
PROCESS SELECTION OPTIONS
Selection criteria can be: terminal, user, pid, command. The options below may be used to ensure correct interpretation.
-t, --tty tty
The next expression is a terminal (tty or pty).
-u, --user user
The next expression is a username.
-p, --pid pid
The next expression is a process ID number.
-c, --command command
The next expression is a command name.
--ns pid
Match the processes that belong to the same namespace as pid.
--nslist ns,...
list which namespaces will be considered for the --ns option. Available namespaces: ipc, mnt, net, pid, user,
uts.
SIGNALS
The behavior of signals is explained in signal(7) manual page.
EXAMPLES
snice -c seti -c crack +7
Slow down seti and crack commands.