Processes and ports

  • Posted on July 19, 2011 at 08:04

Ever wondered which process is behind which port? Well, I do pretty often!
And also pretty often I have to look it up again…
Let’s change that for once and for all!

Here’s a really obvious example with port number 80 in use by Apache. (Such a surprise!)

Netstat: The syntax
# netstat -a -n -p | egrep 'Proto|LISTEN' | grep 80
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1840/apache20

 

Forcing open doors
This output shows that Apache2.0 runs with PID 1840 and it’s listening to port 80.

After this I did a ‘ps aux | grep 1840’ and it turned out to be true! 🙂

 

 

Leave a Reply