killx william 发布于 2023-02-09 收录于 Tools通过获取进程 PID 来杀死进程。 1 2 3 4 5 6 7 8 9 10 11 killx () { list=$(ps aux | grep -i $1| grep -v grep |grep -v color) if [ -n "$list" ]; then dead=$(ps aux | grep -i $1| grep -v grep| grep -v color | awk '{print $2}') echo "Killing... $1" echo $dead |xargs kill -9 else echo "Not running $1" fi }