Skip to content

Instantly share code, notes, and snippets.

@wut0n9
Created February 12, 2019 03:30
Show Gist options
  • Save wut0n9/955fe19540c9000f8b84925f087a02fe to your computer and use it in GitHub Desktop.
Save wut0n9/955fe19540c9000f8b84925f087a02fe to your computer and use it in GitHub Desktop.
# 杀多进程
#!/usr/bin/env bash
KEYWORD="PROC_NAME"
theadPidList=$(ps aux | grep ${KEYWORD} | grep -v grep | awk '{print $2}')
for threadPid in ${theadPidList};
do
sudo kill -9 ${threadPid}
echo "Thread ${threadPid} is killed"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment