ANS Documentation

Improve This Doc
  • Cloud
  • Domains and DNS management
  • Backup and High Availability
  • eCommerce Stacks
  • Security
  • Email
  • Monitoring and usage management
  • Networking
  • Operating systems
    • Linux
    • VMware ESXi
    • Windows
      • Active Directory
      • Common Issues
      • Exchange
      • FTP
      • IIS
      • MSSQL
      • Networking
      • TLS 1.2 in PowerShell
      • RDP
      • Windows Server 2016
      • SSL/TLS and Schannel
      • Windows Administration
  • Webcelerator
  • MyUKFast
  • Home >
  • Operating systems >
  • Windows >
  • Windows Administration >
  • Using the netstat command to find port information

Using the netstat command to find port information¶

To run the netstat command, you will first need to open a Command Prompt as administrator, to do so, please select start, type cmd, right click the resultant cmd.exe and “Run as Administrator” as below

CMD

Finding processes running on a port¶

  • In order to find what process is running on a specific port in Windows, you need to utilise the netstat command

In the Command Prompt, type netstat -ano | find ":Required port number", for example, if you wish to find out what process is listening on port 25, you would type netstat -ano | find ":25" and hit Enter

The Command Prompt will now display any processes listening on port 25 as below

Netstat 25

At the right hand side of the result, you will see a number, this number is a PID (Process Identifier), this number is assigned to a specific process on your server.

To find out what process is assigned the displayed PID, right click on the task bar, and select “Task Manager”, once task manager has presented itself, select the “processes tab” and right click on the status title.

This will now display a context box with a number of options as below, please select “PID” from the list.

Enable PID

now search through the list of PID’s to find the one matching the PID listed by your netstat command, in this example 844,which as you can see below is occupied by the hMailServer application.

PID Found

This means that port 25 is being occupied by hMailServer, which is as expected.

The netstat command can be extended to count the number of connections on a specific port, you can do this by adding /c to the end of the command. for example

netstat -ano | find ":25"` /c

What port is my service listening on?¶

  • In order to find out what port a specific service is listening on, you simply use the netstat command again, but in a slightly different way.

In the Command Prompt, type netstat -ano and press enter.

This will present you with a list of all current connections to and from your server as below

Flat netstat

Right click on the taskbar, and select task manager, again, select processes, and right click on the title bar, Select “PID” from the resultant list. Find the the PID of the program for which you are trying to find the corresponding port, now review the connections in Command Prompt to find the Correct PID, look to the left of the Command Prompt on the matching line to see which port that specific PID is using.

Next Article > Testing Basic connectivity Using Telnet

  • Useful Links
  • SMB
  • Enterprise
  • Channel
  • Public Sector
  • ANS Data Centres
  • About ANS
  • Careers
  • Blog
  • Get in touch
  •  
  • Sales 0800 458 4545
  • Support 0800 230 0032
  • Get in touch

© ANS Group Limited | Terms and Conditions | Corporate Guidance | Sitemap
ANS Group Limited, registered in England and Wales, company registration number 03176761, registered office 1 Archway, Birley Fields, Manchester M15 5QJ