Find running ports

Anil R
Oct 11, 2024

--

To find out which port numbers are being used on your Mac, you can use the lsof (List Open Files) and netstat commands in the terminal. Here are two methods:

Using lsof to Find Open Ports

You can use the lsof command to list all the open files and find which ports are being used.

Open the Terminal and type the following command:

sudo lsof -i -P -n

Explanation:

  • -i lists all network files.
  • -P shows port numbers instead of service names.
  • -n avoids resolving hostnames.
  • sudo is required to show all the information, including ports in use by system processes.
sudo lsof -i :<port_number>

--

--

Anil R
Anil R

Written by Anil R

Full Stack Developer with 15 years experience.

No responses yet