Check Open Ports

If you’re running a Linux server, here’s one way of checking as to which ports are open to the public. You can use netstat for that purpose. Netstat is a command-line network utility tool that displays network connections for tcp, routing tables, and a number of network interfaces. It’s available on Linux, MacOS and Windows.

In Linux and MacOS, type the following via the Terminal.

netstat -lnptu
# -l = only services which are listening on some port
# -n = show port number, don't try to resolve the service name
# -t = tcp ports
# -u = udp ports
# -p = name of the program

If you’re in Windows, open up Powershell and type in:

netstat -no
# or
netstat -o 5

Don’t be surprised as to what your computer is doing.

One thought on “Check Open Ports

  1. I have never bothered to look up each switch, but the one I always remember is ‘netstat -peanut’.
    And yes, it is often a little scary to see who is phoning home!

Comments are closed.