I was recently trying to debug an app that had gone rouge on a server because of a PHP upgrade. It was a web based application listening on a particular port and after the upgrade it just returned 500 server errors. A quick scan of the Apache logs, and even a deeper grep of them returned no matching errors so I realized, although the application was using PHP it was using another process to serve the pages. The urls of the application had the port 8443, so I knew whatever was serving it up was listening on that port.
By default netstat tries to give you a human readable list of services. But with the -n flag you can see the numeric ports. You’ll also need to add -l (show listening ports) or -a (show all ports) since the listening ports are not included by default. -p will include the process id and the “program” that is listening which is what we really want. Grep is a nice way to narrow things down after that…
$ netstat -nlp | grep 8443
tcp 0 0 0.0.0.0:8443 0.0.0.0:*