pgrep & pkill 用法


查看 nginx 进程

[root@97lab ~]# ps -A | grep -i nginx
 1435 ?        00:00:00 nginx
 1436 ?        00:01:15 nginx
 1438 ?        00:01:21 nginx

使用 pgrep

[root@97lab ~]# pgrep -l nginx
1435 nginx
1436 nginx
1438 nginx

[root@97lab ~]# pgrep
pgrep: No matching criteria specified
Usage: pgrep [-flvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
    [-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]

kill 进程

kill 1435 1436 1438

使用 pkill

pkill nginx

[root@97lab ~]# pkill
pkill: No matching criteria specified
Usage: pkill [-SIGNAL] [-fvx] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST]
    [-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
分享:

评论