Kill process by fuzzy name

9 years ago
Sometimes you want to kill a process but you either don’t know the exact name of the executable file, or you know part of the command arguments. killall is not your friend in those situations. Here’s a quick script to grep on part of a process name or arguments and kill it.


Full script (put it in a path included folder and change it’s permissions to executable +x):

#!/bin/bash
ps aux | grep $1 | grep -v grep | awk '{print $2}' | xargs kill -9