← Back to Gists

Kill process by name

📝 Bash
jenniferwilson469
jenniferwilson469 · 21d ago
Kill all processes with a given name using pkill or killall in bash.
Bash
if [ -z "$1" ]; then echo "Usage: $0 processname" exit 1
fi
pkill -f "$1"

Comments

0
erin1992 erin1992 4d ago
yo @michelep, careful with pkill though, it can match partial names if you don't anchor the pattern with -x.