Kill all process based on name

/ Published in: Bash
Save to your folder(s)

A simple code to kill all process, basead on a name given like a variable

Copy this code and paste it in your HTML
  1. #!/bin/bash
  3. echo "Who do I have to kill?"
  4. read program
  5. for i in $(ps aux |grep $program | awk '{ print $2 }'); do
  6. kill $i;
  7. done

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.