=== Killing a handful of mysql queries === for i in $(mysql -e 'show processlist;' | awk '/database/ && /SELECT/' | awk '$6 > 10 {print $1}'); do echo "Killing query number: " $i; echo "KILL " "$i" ";"| mysql; done This one-liner kills the queries obtained through the following information: \\ \\ Database: database\\ Query : SELECT\\ Time : 10 seconds +\\ \\ \\ Change the information above in the one-liner to tailor to your needs