Quick-Tip – Netstat: Processes and Port Numbers

Earlier today I needed to kill a process that was occupying a specific port of a network. After a quick search online I learned from a website that Netstat can list listening sockets and provide the program PID’s which are using a specific port. The command to do this is as follows;

netstat -lp

This approach can be further refined if you know which port to look for, by piping a grep command afterwards with a specified port number;

netstat -lp | grep <port #>