Skip to content

Instantly share code, notes, and snippets.

@stroehleina
Created November 29, 2023 09:07
Show Gist options
  • Save stroehleina/216dba2a6a58d461b6a756b2753b2869 to your computer and use it in GitHub Desktop.
Save stroehleina/216dba2a6a58d461b6a756b2753b2869 to your computer and use it in GitHub Desktop.
Find processes by name and SIGTERM kill them all (when an application is hung up and cannot be closed)
# Usage: kill_app_by_pid.sh <name_of_application>
# https://docs.oracle.com/cd/E19253-01/817-0403/eoizf/index.html
# WARNING: The –9 signal should not be used to kill certain processes, such as a database process, or an LDAP server process.
# The result is that data might be lost.
ps -u $USER -eaf | grep -i $1 | awk '{print $2}' | while read line; do kill -9 $line; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment