Sobes.tech
Senior

How to see which ports are currently listening on the machine?

sobes.tech AI

Answer from AI

To see which ports are currently listening on your machine, you can use several commands depending on your operating system:

  • On Linux and macOS:
sudo netstat -tuln

where:

  • -t — TCP,
  • -u — UDP,
  • -l — only listening ports,
  • -n — show port numbers and IPs without resolving names.

You can also use ss:

sudo ss -tuln
  • On Windows:
netstat -ano | findstr LISTENING

These commands will show a list of all ports on which services are running, along with their associated process IDs.