I have a small Java ServerSocket application that is running on port 4444. I wanted to see the process using that port in my OSX terminal, and my first thought was to do the following:
netstat -a | grep 4444
however, this doesn't give me any results.
lsof -i :4444
and I get the following (correct) result:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 66389 admin 18u IPv6 0x1ae123a422ebe931 0t0 TCP *:krb524 (LISTEN)
Could someone tell me why netstat doesn't show the port but lsof does?
Best Answer
Mac OSX is based on BSD so the
netstat
under Mac OSX will not be able to show you the pid/process name. As you already figured out,lsof
is the right choice.