Created
April 29, 2019 16:58
-
-
Save srt32/69770795c9baae0a0f12b2196ecddef1 to your computer and use it in GitHub Desktop.
`killportprocs 3000` - will print and then kill all the pids bound to port 3000
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
killportprocs() { | |
local targetport=${1:?pass in target port} | |
local pids=$(lsof -i :$targetport | awk '{print $2}' | tail +2) | |
echo "$pids" | |
echo $pids | xargs kill -9 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment