码迷,mamicode.com
首页 > 系统相关 > 详细

kill 发送消息给进程命令

时间:2020-01-10 10:44:46      阅读:137      评论:0      收藏:0      [点我收藏+]

标签:进程   kill   res   command   span   value   only   info   name   

功能:

kill命令发送信号给进程。

格式:

 

kill [-s signal|-p] [-q sigval] [-a] [--] pid...
kill -l [signal]

kill [-s <信息名称或编号>][程序] 或 kill [-l <信息编号>]

 

参数:

OPTIONS
pid... Specify the list of processes that kill should signal. Each pid can be
one of five things:

n where n is larger than 0. The process with pid n will be sig‐
naled.

0 All processes in the current process group are signaled.

-1 All processes with pid larger than 1 will be signaled.

-n where n is larger than 1. All processes in process group n are  //信息编号
signaled. When an argument of the form ‘-n‘ is given, and it is
meant to denote a process group, either the signal must be speci‐
fied first, or the argument must be preceded by a ‘--‘ option,
otherwise it will be taken as the signal to send.

commandname
All processes invoked using that name will be signaled.

-s, --signal signal //信息名称
Specify the signal to send. The signal may be given as a signal name or
number.

-l, --list [signal] //打印编号
Print a list of signal names, or convert signal given as argument to a
name. The signals are found in /usr/include/linux/signal.h

-L, --table
Similar to -l, but will print signal names and their corresponding num‐
bers.

-a, --all
Do not restrict the commandname-to-pid conversion to processes with the
same uid as the present process.

-p, --pid
Specify that kill should only print the process id (pid) of the named
processes, and not send any signals.

-q, --queue sigval
Use sigqueue(2) rather than kill(2) and the sigval argument is used to
specify an integer to be sent with the signal. If the receiving process
has installed a handler for this signal using the SA_SIGINFO flag to
sigaction(2), then it can obtain this data via the si_value field of the
siginfo_t structure.

实例:

-l 编号

技术图片

 

 1.2 发送SIGHUP信号,可以使用一下信号 

技术图片

 

 1.3  彻底杀死进程

技术图片

kill 发送消息给进程命令

标签:进程   kill   res   command   span   value   only   info   name   

原文地址:https://www.cnblogs.com/gaiting/p/12174703.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!