Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

As I enter the netstat command in the terminal, I get the following list.

Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address               Foreign Address             State      
tcp        1      0 localhost:35543             Feddy:http                  CLOSE_WAIT  
tcp        0      0 Feddy:42505                 tb-in-f125.1e10:xmpp-client ESTABLISHED 
tcp        0      0 Feddy:34534                 maa03s05-in-f5.1e100.:https ESTABLISHED 
tcp        0      0 localhost:mysql             localhost:33292             TIME_WAIT   
tcp        0      0 Feddy:55558                 stackoverflow.com:http      ESTABLISHED 
tcp        0      0 Feddy:58290                 stackoverflow.com:http      ESTABLISHED 
tcp        0      0 localhost:mysql             localhost:33291             TIME_WAIT   
tcp        0      0 Feddy:58279                 stackoverflow.com:http      ESTABLISHED 
tcp        0      0 Feddy:42496                 tb-in-f125.1e10:xmpp-client ESTABLISHED 
tcp        0      0 Feddy:36830                 a96-17-182-73.deploy.a:http ESTABLISHED 
udp        0      0 Feddy:39379                 192.168.6.1:nat-pmp         ESTABLISHED 
Active UNIX domain sockets (w/o servers)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ]         DGRAM                    8377   /run/systemd/notify
unix  2      [ ]         DGRAM                    7908   /run/systemd/shutdownd
unix  30     [ ]         DGRAM                    7922   /dev/log
unix  3      [ ]         STREAM     CONNECTED     22732  
unix  3      [ ]         STREAM     CONNECTED     608830 @/tmp/dbus-4HbiJa7bKU
unix  2      [ ]         DGRAM                    90425  
unix  3      [ ]         STREAM     CONNECTED     18947  
unix  3      [ ]         STREAM     CONNECTED     25740  
unix  3      [ ]         STREAM     CONNECTED     23327  @/tmp/dbus-4HbiJa7bKU
unix  3      [ ]         STREAM     CONNECTED     24162  
unix  3      [ ]         STREAM     CONNECTED     23714  
unix  3      [ ]         STREAM     CONNECTED     22566  
unix  3      [ ]         STREAM     CONNECTED     675499 @/tmp/.ICE-unix/1667
unix  3      [ ]         STREAM     CONNECTED     91140  
unix  3      [ ]         STREAM     CONNECTED     23601  
unix  2      [ ]         DGRAM                    148102 
unix  3      [ ]         STREAM     CONNECTED     90614  

But I don't see all the open ports. For example I have xampp server running at port number 80 , oenfire server running at port number 9090. Where are those ports ?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

What you are looking for is netstat with the -l switch, as in "listen".

What we usually call an "open port" is actually a listening socket on which a program is bound. It can be on any interface (0.0.0.0:port) or interface-specific (127.0.0.1:port for 'loopback'). When a program is bound to this socket, the kernel allows packets destinating there and forwards them. If no program is bound on the said socket, the packet is dropped. hence the "open/closed" terminology.

You may anlso want to use the -n switch to prevent netstat from transforming port numbers and host addresses in to their respective names.

To do the test remotely, please have a look at the nmapcommand.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.