what_ports_are_in_use

This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.



Subject: Re: How to check what ports are being used??
From: a mole <mole@pasdex.com.au>
Date: Sat, 18 Dec 1999 14:36:10 +1000 (EST)


On Fri, 17 Dec 1999, Steve <sgulick@poboxes.com>  wrote:

> Is there a command that will list the ports that are being used and
> what is it?

> Or is this a stuuuupppid question and I'm just having a very bad day?

	the highly excelent program lsof tells you what you
want to know.  Running 'lsof -i' will tell you all the
networking ports open and the command, pids, users names ect
associated with the port.  I'm pretty sure lsof is standard
issue on redhat these days...

===

Subject: Re: How to check what ports are being used??
From: "Greg W" <redhat_list@mail.com>
Date: Sat, 18 Dec 1999 16:52:04 +1100

I was looking forward to trying lsof -i   but none of my boxes have
it.....what provides this...

however, maybe one of these combinations will help Steve....

netstat
netstat -an

or to refresh 

watch netstat
watch netstat -an

===

Subject: Re: How to check what ports are being used??
From: "Arni Raghu" <arni@caip.rutgers.edu>
Date: Sat, 18 Dec 1999 01:52:13 -0500

did not come with my redhat...

Just download it from freshmeat...very useful and great program..

===

Subject: Re: How to check what ports are being used??
From: Alan Mead <adm@ipat.com>
Date: Fri, 17 Dec 1999 17:26:16 -0600


At 04:37 PM 12/17/99 -0500, Steve wrote:
>Is there a command that will list the ports that are being used and what
is it?
>
>Or is this a stuuuupppid question and I'm just having a very bad day?

The file /etc/services lists the services that are supposed to be running.
So if someone tries to connect to port 110, look in /etc/services to see
what service usually answers that request.  But be aware that some (many?
all?) services do things like negotiate other ports (e.g., ftp) so port
10182 could be busy with an ftp or telnet session.

'netstat' will tell you about "open" connections but not about other ports.
 There is a package called ntop that does a better job of what you want to
do.  And there are others.

===

Subject: Re: How to check what ports are being used??
From: linuxlists@whatever.net
Date: Fri, 17 Dec 1999 02:54:50 -0800 (PST)


On Fri, 17 Dec 1999, Steve wrote:

> Is there a command that will list the ports that are being used and
> what is it?

Is this what you're looking for?

cat /proc/net/tcp
cat /proc/net/udp
and cat /proc/net/unix just for good measure

It might be nice to have a perl script to turn the tcp and udp stuff into
a more readable format.  It took a minute to figure out that them big hex
numbers were my ip addresses in reverse. :-)

/proc/net/ip_masq/* might be worth a look too if you're doing any
masquerade stuff.  I'm not, so the files therein aren't very interesting!

===

Subject: Re: How to check what ports are being used??
From: JWalsh <jwalsh@adsl-78-160-122.gnv.bellsouth.net>
Date: Sat, 18 Dec 1999 15:16:01 -0500 (EST)

> The file /etc/services lists the services that are supposed to be running.
> So if someone tries to connect to port 110, look in /etc/services to see
> what service usually answers that request.  But be aware that some (many?
> all?) services do things like negotiate other ports (e.g., ftp) so port
> 10182 could be busy with an ftp or telnet session.

This file specifies well known ports which the services listed use.
It does not indicate what services are supposed to be running.
And it isn't necessarily accurate if the administrator chooses to specify
a different port for a given service.
J.
===


the rest of The Pile (a partial mailing list archive)

doom@kzsu.stanford.edu