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
313 B

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