Netstat
Netstat stands for Network and Statistics is a common command-line TCP/IP networking utility available in most versions of Windows, ie from XP to 10, Linux, UNIX, and other operating systems.
Netstat provides information and statistics about protocols in use and current TCP/IP network connections. The parameters for netstat are preceded with a hyphen, not a forward slash like many other commands.
netstat -a -n -o
-a : all active connections and the ports on which the computer is listening.
-n : show the IP addresses and ports as numbers only
-o : tells netstat to include the PID.
In order to find all ports listening
Both from cmd & bash
netstat -a -n -o
Find specific ports listening
From Bash
netstat -aon | grep "port"
From CMD
netstat -aon | find "port"
Kill the Port using PID
taskkill /F /pid <process ID>