How can I see what ports are open on my machine?

1

To list open ports use the netstat command.

For example:

$ sudo netstat -tulpn | grep LISTEN tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN 5452/dnsmasq tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 1037/cupsd tcp6 0 0 ::1:631 :::* LISTEN 1037/cupsd

In the above example three services are bound to the loopback address.

IPv4 services bound to the loopback address "127.0.0.1" are only available on the local machine. The equivalent loopback address for IPv6 is "::1". The IPv4 address "0.0.0.0" means "any IP address", which would mean that other machines could potentially connect to any of the locally configured network interfaces on the specific port.

Another method is to use the lsof command:

$ sudo lsof -nP -i | grep LISTEN cupsd 1037 root 9u IPv6 11276 0t0 TCP [::1]:631 (LISTEN) cupsd 1037 root 10u IPv4 11277 0t0 TCP 127.0.0.1:631 (LISTEN) dnsmasq 5452 nobody 5u IPv4...
0 0
2

by

Jonas

Last Updated August 25, 2017 11:02 AM

I would like to see what ports are open on my machine, e.g. what ports my machine is listening on. E.g. port 80 if I have installed a web server, and so on.

Is there any command for this?

Answers 8

Nmap ("Network Mapper") is a free and open source utility for network exploration or security auditing

nmap 192.168.1.33 internal Pc or nmap external ip address

more information man nmap

hhlp
October 25, 2010 12:55 PM

Other good ways to find out what ports are listenting and what your firewall rules are:

sudo netstat -tulpn

sudo ufw status

nathwill
October 25, 2010 14:38 PM

sudo iptables -L will list the port rules for your pc. Note that if you are using ufw or shorewall firewalls the output maybe be hard to read. In that case rather use sudo ufw status for example.

This is not very useful on its own as even if a port is...

0 0
3

[Summary]How can I quickly find listening/open ports on my computer ? You can use the NETSTAT command to quickly see all the used and listening ports on your computer. How to check opened/closed port on my computer? I was wondering how to check the opened/clo

Advertisement

How can I quickly find listening/open ports on my computer ?

You can use the NETSTAT command to quickly see all the used and listening ports on your computer.

How to check opened/closed port on my computer?


I was wondering how to check the opened/closed port on my computer. I used netstat -a on command line. Does the port status "LISTENING" indicate that the port is open? Is any port, that is not sho...

How do I open up ports to my computer (port forwarding) on this router?

How can I see what ports are open on my machine?


I would like to see what ports are open on my machine, e.g. what...

0 0
4

You can use the

NETSTAT

command to quickly see all the used and listening ports on your computer. Note it is not a complete substitute for a port scanning tool. If you'd like to have your computer remotely scanned for vulnerable open ports use our

Security Scan

instead.

To see a list of listening ports, open Command Prompt and type:

C:\> netstat -ano |find /i "listening"

You can change "listening" to "established" to see what ports your computer actually communicates on at the moment.

It is very useful to also use the -o switch with the netstat command to get a list of all the owning process ID associated with each connection. You can then use those process ids (PIDs) to find out the name of the processes associated with open/listening ports in the Windows Task Manager (the "Details" tab lists process ids).

C:\> netstat -ao |find /i "listening"

To see all open, closing, established and listening ports, simply use:

C:\>...

0 0
5
H

ow do I find open ports on Linux or FreeBSD Unix server?


There are different commands on both Linux and UNIX server to see what TCP/UDP ports are listening or open on your server. You can use netstat command, which prints network connections, routing tables, interface statistics, masquerade connections, and multicast memberships, etc. Another (and suggested) option is to use the lsof command, which lists open files, and ports on Linux, FreeBSD, Solaris and other Unixish systems.

netstat command to find open ports

The syntax is:
# netstat --listen
OR
# netstat -l
Sample outputs from my Debian 8.x Linux server:

Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:953 *:* LISTEN tcp 0 0 localhost:6010 *:* LISTEN tcp 0 0 localhost:4700 *:* LISTEN tcp 0 0 *:nfs *:* ...
0 0
6

2011 iMac running Mavericks

I have a number of hard drives on my machine, including a standard internal drive, an external SSD on Thunderbolt, a standard external drive on thunderbolt, a standard external drive on Firewire, and a standard external drive on USB.

What I'm not sure of without crawling around and tracking cables and other investigative work, is which volume on my computer goes with which drive, and therefore which connection technology. It's just been too long since I set it all up.

I thought for sure this information would be in Disk Utility, but it seems it's not (or I can't find it). Then I thought for sure it would be in System Profiler (System Information) but it's not (or I can't find it).

How can I find out which connection technology is being used by each volume on my machine?

EDIT: I was able to deduce which drive had to be which from process of elimination, since I found that System Information will show me (under the...

0 0
7

What ports are open for hacking on my Mac?

Here is how to see what ports are open listening on a server.

This is perhaps the most important potential vulnerability.

Having ports listenting to outside traffic also takes a bit of CPU, which consumes electricity and thus reduce battery life.

Spotlight on Network Utility to List Ports

Apple’s Spotlight is like Window’s Search omni-box. *

Press Command+Spacebar.

Type the name of utilities that are buried, such as Network Utility.

Click the keyboard return/enter key to launch the Network Utility app.

Select the "Port Scan" tab.

Enter the IP (such as 127.0.0.1), localhost, or domain name you wish to scan for open ports.

Choose scan to see what ports the server responds to.

List open files = lsof

In a Terminal command line:

lsof -nP +c 15 | grep LISTEN

PROTIP: If you’ll be using this often, create...

0 0
8

You cannot ping a specific port. A "ping" is an ICMP echo request. ICMP is an internet layer protocol and as such has no concept of a "port".

You could use a Socket to attempt to establish a TCP connection to the port. If it connects, then something was listening for TCP connections. If it doesn't connect, then it was unreachable in some way.

You could use a DatagramSocket to attempt to send a packet to the port. If it succeeds, then something is probably receiving data. If it fails, then something definitely went wrong (incidentally, an ICMP error message is sent back if a UDP packet is received that is addressed to a port that is not open for UDP, or if something actively refuses the packet on the way).

You'd have to use both of the above to check both TCP and UDP.

Note that InetAddress uses an ICMP request as ping by default, but if it does not have permission to do that, it will fall back on attempting to establish a TCP connection instead. However,...

0 0
9

Cryptojobslist.com(34 seconds ago)

Freeonlinewebsiteurlshortenerforanywebsitethatrequiresshorturls.com(1 min ago)

Theill.com(9 seconds ago)

Acs.org(15 seconds ago)

Roadtrip-online.com(13 seconds ago)

Gesd32.org(21 seconds ago)

Yongdean.com(3 seconds ago)

Albinoblacksheep.com(1 min ago)

Edu-a.net(6 seconds ago)

Wgiprint.com(11 seconds ago)

3456555.com(1 seconds ago)

Pleaseapplyonline.com(10 seconds ago)

Matchcode.com(7 seconds ago)

Youneed.com(47 seconds ago)

Exchange-metal.com(0 seconds ago)

Bcmch.org(21 seconds ago)

Wl-zg.com(15 seconds ago)

Inthemidstofchaos.org(10 seconds ago)

Harutmarut.com(31 seconds ago)

Growambrosia.net(17 seconds...

0 0
10
Hi, I have a program, and I want it to check for any open ports before it loads the main program.

Would this be hard to do?

Basically, I want it just to check to see if they are open or not, if the ports arnt then it will continue to execute the program, if they are already open and being used I would like it to popup a message warning the person, and disallowing the program to run until they are closed...

I hope you guys understand what i mean.

Hope someone can help with this as its kinda urgent

Thanks in advance
DanJ

If U mean TCP than in common case U can try to connect (connect()) to specified port. Then by its result U can get what U need. But that would mean i would need to do it for around 6 ports...

Also i need to be able to check UDP ports..

How would I go about doing this as well?

I have no idea where to start with code on this one, or where to put it

If anyone can help me i would...

0 0
11

I have a Verizon DSL Router that I've used to set up port-forwarding to 6112 UDP and TCP to my computer using its hostname.

In Windows 7 Advanced Firewall, I have set up two rules; one for TCP and one for UDP to allow inbound connections to port 6112.

• With both firewalls on, I test port 6112 on www.canyouseeme.org. The message I get is "I could not see your service ... Reason: Connection timed out."

• With the router's firewall on and Windows Firewall off, I get the message "I could not see your service ... Reason: Connection refused." All other ports get "Reason: Connection timed out."

I have tried this with and without the custom rules for port 6112 in Windows Firewall. Results are the same.

Edit: I assume the router is working properly, because when the port-forwarding rule is disabled on it (even when the firewall is turned to off/low security), I get the "Connection timed out" message, both with and without Windows Firewall being active....

0 0