Task:
Kill many processes with same name. If your program use a lot fork(), It will generate many same name process.
How to do this:
#!/bin/bash
s=$( ps aux|grep <application name here>|head -n -1|cut -d ' ' -f 2-3)
for foo in $s
do
echo "kill " $foo
kill $foo
done
save it and change the application name
Kill many processes with same name. If your program use a lot fork(), It will generate many same name process.
How to do this:
#!/bin/bash
s=$( ps aux|grep <application name here>|head -n -1|cut -d ' ' -f 2-3)
for foo in $s
do
echo "kill " $foo
kill $foo
done
save it and change the application name
本文介绍了一种使用 Bash 脚本批量终止具有相同名称的进程的方法。此方法适用于那些频繁使用 fork() 函数创建子进程的应用场景,帮助快速清理大量同名进程。
5582

被折叠的 条评论
为什么被折叠?



