Skip to content

Instantly share code, notes, and snippets.

@Antarian
Last active January 7, 2024 17:52
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 Antarian/5bb5a84e825f77d8fba010a497cdd395 to your computer and use it in GitHub Desktop.
Save Antarian/5bb5a84e825f77d8fba010a497cdd395 to your computer and use it in GitHub Desktop.
Ubuntu port freeing

Find on port (second column is process_id):

sudo lsof -i -P -n | grep {port number}

Kill on port:

sudo kill {process_id}

Hard kill on port:

sudo kill -9 {process_id}
@andrey-legayev
Copy link

I usually run sudo netstat -nlpt to understand who is keeping TCP ports opened for listening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment