Skip to content

Instantly share code, notes, and snippets.

@baybatu
Last active December 15, 2015 05:27
Show Gist options
  • Save baybatu/4065756 to your computer and use it in GitHub Desktop.
Save baybatu/4065756 to your computer and use it in GitHub Desktop.
Kill tomcat from terminal easily
#!/bin/bash
ps -A | grep tomcat | awk '$4 !~ /grep/ {print $1}' | xargs kill -9

You have to make the script executable via 'chmod' before execution. If the script file name is 'tomcat_killer.sh'

$ sudo chmod +x tomcat_killer.sh

then to create shortcut, rename the file to 'k' and copy to /usr/bin/ (or one of the another path in PATH variable)

$ sudo mv tomcat_killer.sh k
$ sudo cp k /usr/bin

now k kills Tomcat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment