List open ports – netstat

netstat can be used to list all open ports on a machine Linux

$ netstat -an | grep -i listen
Command options will be different in diff version of linux

Windows

> netstat -a | find /i "listening"
> netstat -b     //will show the process names
> netstat -?

Powershell with netstat, netsh

Powershell also makes it easy to use and process the output from netstat, netsh or any other commands.

C:\> $n = netstat
C:\> $n | select-string "listening"

(See links below for related articles. Powershell allows getting net statistics via cmdlets like Get-NetIPAddress, the .net classes in System.Net.Networkinformation etc.)

Links on the web used for info:

Advertisements

One thought on “List open ports – netstat

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s