Skip to content

Instantly share code, notes, and snippets.

@R0X4R
Created July 12, 2021 08:19
Show Gist options
  • Save R0X4R/d211d1c1bd804cc46edff79f8c9102c3 to your computer and use it in GitHub Desktop.
Save R0X4R/d211d1c1bd804cc46edff79f8c9102c3 to your computer and use it in GitHub Desktop.
Helps you to kill unnecessary tasks running on linux and ubuntu.
#!/bin/bash
# Task Killer
# Helps you to kill unnecessary tasks running on linux and ubuntu.
echo -e "$1 - Killing task..."
totaltask=$(ps aux | grep "$1" | sed '/grep/d' | wc -l)
echo -e "Total $totaltask tasks found"
sleep 3s
ps aux | grep "$1" | sed '/grep/d' | awk '{print $2}' | while read -r line; do kill $line; done &> /dev/null
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment