Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nepsilon/811bad84a425c6c77a528dd88a102b32 to your computer and use it in GitHub Desktop.
Save nepsilon/811bad84a425c6c77a528dd88a102b32 to your computer and use it in GitHub Desktop.
How to find the PID of a process using a given port? — First published in fullweb.io issue #80

How to find the PID of a process using a given port?

Sometimes you have a process you lost the PID, and would like to kill it.

You can use top (or better htop) to search for your process name and press k to kill it. But this isn’t optimal when you aren’t sure of its name. A better alternative is to search by the port opened, for example port 80:

sudo lsof -i :80

Remember to use sudo. The process PID will be in the second column. Happy process killin’ 👾

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