一行命令杀掉defunct进程

一行命令杀掉defunct进程

今天在杀掉defunc过程中一直搞不完,索性写一行命令,注意先看懂谨慎使用
ps -ef|grep defunct|awk '{print " ps -ef|egrep 47"$2"|"$3"47"}'|sh|sort -r|awk '{print "kill -9 "$2}'|sh
注意该命令执行会退出当前shell

2019529 日更新,去掉当前进程和过滤命令行:
ps -ef|grep defunct|egrep -v $PPID'|grep'|awk '{print " ps -ef|egrep 47"$2"|"$3"47"}'|sh|sort -r|awk '{print "kill -9 "$2}'|sh

原文地址:https://www.cnblogs.com/luomgf/p/10883673.html