# command to list open ports?

## Kindred

The old admin left so I don't know what some server applications are using for ports, so what is the command to see?

----------

## ElForesto

This will list things being listened for:

```
netstat -l
```

If that doesn't give you what you want, check the man page.  :Smile: [/code]

----------

## hensan

You can also try nmap.

----------

## beandog

 *hensan wrote:*   

> You can also try nmap.

 

Yahp.  nmap localhost

----------

## kashani

netstat -ptln is a bit more readable IMO.

kashani

----------

## krolden

 *sdibb wrote:*   

>  *hensan wrote:*   You can also try nmap. 
> 
> Yahp.  nmap localhost

 

Won't that give incorrect results?

If your IPtables are configured that all packets from lo interface are to be accepted, you will see all your packets get through.

Besides, I don't think nmap can handle localhost, at least the older versions couldn't scan when giving 127.0.0.1 as target IP.

Anyways, check this out.  It might prove convenient.

http://www.linuxsecurity.com/docs/LDP/Security-Quickstart-HOWTO/appendix.html#NETSTAT

----------

## beandog

 *Krolden wrote:*   

>  *sdibb wrote:*    *hensan wrote:*   You can also try nmap. 
> 
> Yahp.  nmap localhost 
> 
> Won't that give incorrect results?
> ...

 

Yes, you're right -- if you run it locally, it will display all the ports that are open that you locally can connect to, but not from the outside in.  Still its a quick and dirty indication if you just want to know what's running.

----------

