kill -p 参数

来源:互联网 发布:qq音乐 mac 版权破解 编辑:程序博客网 时间:2024/05/22 04:58

linux 提供了kill命令

man 之后发现可以这样使用kill,kill -p 进程名字,打印进程名字对应的pid

举例:

kill -p nginx 可以打印nginx的pid


可是输入了kill -p nginx 提示的却是invalid signal specification

原因是:在shell里面调用kill,默认调用的是shell的内置函数kill,内置函数不包含-p参数,所以有该错误提示


正确的输入应该是  /usr/bin/kill  -p nginx  

也可以加-a参数,代表所有用户


仔细查看kill的man 文档,可以发现这样一句话:

Most modern shells have a builtin kill function, with a usage rather similar to that of the command described here.  The '-a' and '-p' options, and the  possibility to specify processes by command name are a local extension.


在shell里面type kill可以看到kill是shell的内置函数


原创粉丝点击