Saturday, April 4, 2009

netstat + lsof = my friend

linux
  1. "netstat -anpt | grep -i listen | grep 8888" will find out the process id is running on that port.
  2. "/usr/sbin/lsof -p " find out what file and sockets it opens.
  3. "lsof -P -n -i TCP" will list all the TCP sockets with unresolved (numeric) IP and port