OS X/Linux: Check who is listening on a port

shell Sep 18, 2014

If you ever experienced errors like Fatal error: Port xxxxx is already in use by another process
you may be interested in finding out who is actually using that port.

A simple one-liner that works on Mac OSX and Linux will tell you what you need:

lsof -n -i4TCP:$PORT | grep LISTEN

$PORT is the port you are trying to use.

Riccardo Coppola

I help companies with creating better web applications. Certified Level 3 Personal trainer, nutrition geek and biohacker, trained barista and (very) amateur photographer.