Kill duplicate processes in Linux
Here’s a one-liner to kill processes in Linux where there are duplicates
1 | for i in `ps aux | grep php | sort --key=11 | uniq -c -d --skip-fields=10 | sort -nr --key=1,1 | awk '{print $3}'`; do echo $i; kill -9 $i; done |