标签:process pkill roo ash auto 直接 gre str bash
[root@backup ~]# ps -ef |grep rsync root 3500 1 0 10:49 ? 00:00:00 rsync --daemon root 3773 3757 0 13:43 pts/0 00:00:00 grep --color=auto rsync [root@backup ~]# kill 3500 [root@backup ~]# kill 3500 -bash: kill: (3500) - No such process [root@backup ~]# ps -ef |grep rsync root 3775 3757 0 13:44 pts/0 00:00:00 grep --color=auto rsync
扩展:如果不想用ps查看进程号,直接利用kill来结束进程
Pid_Num="/var/run/rsyncd.pid"
kill `cat $Pid_Num`
pkill 9 加进程号强制杀死(慎用)
[root@backup ~]# ps -ef |grep rsync root 3788 1 0 13:47 ? 00:00:00 rsync --daemon root 3790 3757 0 13:47 pts/0 00:00:00 grep --color=auto rsync [root@backup ~]# pkill rsync [root@backup ~]# pkill rsync [root@backup ~]# pkill rsync [root@backup ~]# ps -ef |grep rsync root 3795 3757 0 13:48 pts/0 00:00:00 grep --color=auto rsync
说明:pkill 杀进程时,不提示任何信息
pkill 模式杀手(会造成误杀,慎用),杀进程名
[root@backup ~]# ps -ef |grep rsync root 3780 1 0 13:45 ? 00:00:00 rsync --daemon root 3782 3757 0 13:45 pts/0 00:00:00 grep --color=auto rsync [root@backup ~]# killall rsync [root@backup ~]# killall rsync rsync: no process killed [root@backup ~]# ps -ef |grep rsync root 3786 3757 0 13:45 pts/0 00:00:00 grep --color=auto rsync
说明:kill 和 killall 杀死之后都会有提示
killall 精确杀手,杀进程名
标签:process pkill roo ash auto 直接 gre str bash
原文地址:https://www.cnblogs.com/zhaojingyu/p/9028856.html