kill all processes with a specific string in its name
kill $(ps aux | grep “java” | grep -v ‘grep’ | awk ‘{print $2}’) kills all java processes. grep -v ‘grep’ ignores the current grep command If you need to give them a chance to gracefully shut down first then do this pids=”$(ps -C “java” -o pid,bsdstart | fgrep -v “:” | awk ‘{print $1}’)” … Read more