Useful CLI tools (bash) for Arch Linux administration
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
286 B

6 years ago
6 years ago
  1. #!/usr/bin/env bash
  2. # Kill a process by its name
  3. #####################################
  4. ps aux | grep $1 > /dev/null
  5. mypid=$(pidof $1)
  6. if [ "$mypid" != "" ]; then
  7. kill -9 $(pidof $1)
  8. if [[ "$?" == "0" ]]; then
  9. echo "PID $mypid ($1) killed."
  10. fi
  11. else
  12. echo "None killed."
  13. fi