Andrew Tsen on 3 Aug 2006 14:13:57 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] determining what programs are using what ports


netstat -tnp
 
-p shows PID
-t will show just TCP
-n for numerical

 
On 8/3/06, TuskenTower <tuskentower@gmail.com> wrote:
On 8/3/06, Randy Schmidt <x@altorg.com> wrote:
> Thanks! I used it and it gave me the info I was looking to get...but I
> didn't see anything listening on port 80. When I try to start up
> Apache, it says it can't bind to port 80, is that different from
> another program using that port? I tried port 81 and everything
> worked...
>
> Thanks,
> Randy
>
> On 8/3/06, Jeff Abrahamson <jeff@purple.com> wrote:
> > On Thu, Aug 03, 2006 at 09:28:54AM -0400, Randy Schmidt wrote:
> > >   [18 lines, 87 words, 727 characters]  Top characters: _nieaolr
> > >
> > > Hello:
> > >
> > > I recently set up a ubuntu box and turned it into a server to serve
> > > php and rails applications. Apache was working fine until yesterday
> > > when it stopped working. When I went to restart it, I found that
> > > apparently port 80 was being used by some other application. Is there
> > > an application or command I can use to figure out what programs are
> > > using different ports?
> >
> > netstat -a
> >
> > --
> >  Jeff
> >
> >  Jeff Abrahamson  <http://jeff.purple.com/>          +1 215/837-2287
> >  GPG fingerprint: 1A1A BA95 D082 A558 A276  63C6 16BF 8C4C 0D1D AE4B
> >


Randy,
Just an off-hand thought, check for TIME_WAIT in the netstat ouput
for port 80.  I believe that one often shows up when you stop and
start a service too quickly.  The program using the port is gone, but
the OS is waiting for all communication to end (or something like
that).
netstat -a | grep 80

The man page says:
TIME_WAIT
             The socket is waiting after close to handle packets
still in the network.

Also, the man page says using "netstat -l" will give you only the
ports that are being listened on (heh, I learned something by reading
the man pages).

HTH
Amul
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug



--
- Drew
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug