知乎专栏 |
pgrep, pkill - look up or signal processes based on name and other attributes
$ pgrep lighttpd 6045
[root@netkiller ~]# pgrep -u redis redis 1346809
pkill
$ sudo pkill lighttpd
kill TTY
[root@development ~]# w 16:07:37 up 1 day, 6:23, 6 users, load average: 0.00, 0.06, 0.26 USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT develope pts/0 192.168.3.33 16:01 5:45 0.01s 0.01s -bash jeecen pts/1 192.168.3.129 09:30 7:40 0.00s 0.00s -bash jeson pts/2 192.168.3.101 11:27 42:47 0.03s 0.03s -bash develope pts/3 192.168.3.31 16:03 4:33 0.00s 0.00s -bash root pts/5 172.16.0.1 14:55 1:03m 0.01s 0.01s -bash root pts/6 172.16.0.1 15:47 0.00s 0.03s 0.00s w [root@development ~]# pkill -kill -t pts/3