Skip to content

Instantly share code, notes, and snippets.

@ticklemynausea
Created May 22, 2019 08:33
Show Gist options
  • Save ticklemynausea/9b799aa96f2995a66a9c45135f1d543c to your computer and use it in GitHub Desktop.
Save ticklemynausea/9b799aa96f2995a66a9c45135f1d543c to your computer and use it in GitHub Desktop.
#!/bin/bash
for port in $@
do
for pid in $(lsof -iTCP:$port | awk '{print $2}' | tail -n +2)
do
echo $port: $pid
kill -9 $pid
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment