Mac OS X: find the program running on a port « databasically // Kansas City Small Business IT && Ruby on Rails Programming

 

Sometimes, there’s a program running on a port and you don’t know what it is. How do you find out? I find this happens when I start a webserver up to test something locally and then I forget about it. So, if I wanted to find out what was running on port 80:

  sudo lsof -i :80 # checks port 80
  COMMAND   PID USER   FD   TYPE    DEVICE SIZE/OFF NODE NAME
  ruby    64888   wg    6u  IPv4 0x6ddd270      0t0  TCP *:gds_db (LISTEN)

 
This command shows a list of open files. The -i option checks for internet addresses with the colon symbol representing a port (instead of an actual IP address).

I’m Rich & Co.

Welcome to Tongfamily, our cozy corner of the internet dedicated to all things technology and interesting. Here, we invite you to join us on a journey of tips, tricks, and traps. Let’s get geeky!

Let’s connect