Created
March 7, 2024 14:34
-
-
Save Magnuti/16b5941b5b70700d65f0917ce19e868b to your computer and use it in GitHub Desktop.
Useful .zshrc stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Command for terminating process on a port number | |
# $ kill_on_port <port_number> | |
function kill_on_port() { | |
if [ $# -eq 0 ] | |
then | |
echo "Please provide a port number" | |
return | |
fi | |
if [ -z "$1" ] | |
then | |
echo "No port supplied" | |
return | |
fi | |
kill -9 $(lsof -ti:$1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment