The netstat command is found on both Linux and Windows, though the two versions have slightly different options.

LinuxWindowsDescription
-a-aShows all sockets (listening and established)
-iShows per interface statistics
-lShow only listening ports
-n-nDo not resolve IP addresses or port numbers
-p-obShow PID and binary using the socket (needs root)
-sShow protocol statistics
-t-p TCPShow TCP sockets only
-u-p UDPShow UDP sockets only
-xShow UNIX sockets (kernel-only “network”) only

On Windows, if you know the PID of a process, you can use netstat + findstr to quickly find out what ports its listening on:

netstat -noa | findstr "LISTENING" | findstr "$PID"