This is handy for when you need to know what process is using a particular network socket.

e.g. What process is using socket TCP port 443?


netstat -tapn | grep 443

Example output:

netstat -tapn | grep 443
tcp        0      0 :::443                      :::*                        LISTEN      6996/sshd
tcp        0      0 ::ffff:192.168.11.5:443     ::ffff:192.168.11.3:3190    ESTABLISHED 7065/sshd: troyski

Here we can see that process 6996 (sshd) is using tcp 443.

Note : you have to be root for this to work right.

About troyski

I'm a freelance UNIX engineer working in the UK. I'm married to Tina and between us we have six children. I'm a bit of an Apple fan boy, and all the Windows machines in the house are a thing of the past now.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation