Skip to content

Instantly share code, notes, and snippets.

@ruevaughn
Forked from R0X4R/taskkiller.sh
Created May 30, 2022 07:23
Show Gist options
  • Save ruevaughn/63b2243fbc0f23d70b450ec63f3f34fa to your computer and use it in GitHub Desktop.
Save ruevaughn/63b2243fbc0f23d70b450ec63f3f34fa 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