Last active
February 23, 2020 10:13
-
-
Save YasienDwieb/df61a0b53093cbd103f638a48bfb3e54 to your computer and use it in GitHub Desktop.
Solves port already in use issue by killing processes that use that port
This file contains hidden or 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
#!/bin/bash | |
if [ $# -eq 0 ] | |
then | |
echo "Usage: $0 <port>" | |
exit | |
fi | |
for i in `sudo lsof -i :8080| sed 's/\( \)*/\1/g' | cut -d" " -f2| sort | uniq| egrep -o '[0-9]*'`;do | |
sudo kill -9 $i | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment