Posted By

asfelix on 01/09/11



Versions (?)

Kill all process based on name

 / Published in: Bash

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

  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  

You need to login to post a comment.