Skip to content

Instantly share code, notes, and snippets.

@niketpathak
Last active September 16, 2021 10:33
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 niketpathak/52b4aafb82e27bcf43d83382d9d47307 to your computer and use it in GitHub Desktop.
Save niketpathak/52b4aafb82e27bcf43d83382d9d47307 to your computer and use it in GitHub Desktop.
Free up a specific Port
# Get the process ID of the process running on port xyz
lsof -i -P -n | grep xyz # xyz is the desired port number
# Force kill the process running on the port by providing the process ID you find from the above statement
kill -9 processID
# if you have npm/npx
npx kill-port portNumber
#### More info on lsof ####
# lsof => list open files
# -i => selects IPv[46] files
# -P => No port names
# -n => no host names
####
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment