Skip to content

Instantly share code, notes, and snippets.

@Harold2017
Created March 1, 2019 09:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Harold2017/d318078c0247659753af657156fa6a60 to your computer and use it in GitHub Desktop.
Save Harold2017/d318078c0247659753af657156fa6a60 to your computer and use it in GitHub Desktop.

check port occupied by which process

sudo lsof -i
sudo lsof -i | grep TCP
sudo lsof -i :80 | grep LISTEN
sudo netstat -lptu
sudo netstat -tulpn
sudo ls -l /proc/$pid/exe

list port used by which pid

sudo fuser 80/tcp

release port by killing pid

kill -9 $(fuser 80/tcp 2>/dev/null)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment