How to find what's listening on what port

Peter Barker pbarker at barker.dropbear.id.au
Thu Oct 11 18:56:16 EST 2001


On Thu, 11 Oct 2001, Mark Hummel wrote:

> The output of netstat -A yields the following line:
> 
> tcp        0      0 *:6000                  *:*                     LISTEN 
> 
> How do I discover what is listening on that port? It does not appear in
> /etc/services. 

That's X. And as Andrew pointed out, the --programs option to netstat.

--programs does not seem to work in all cases - I don't know why. I did
write a program (before I knew about --programs) to walk through /proc to
find which programs had ports bound... basically "portprog 8736" or
"portprog 8736 udp" (defaulting to tcp, of course). If anyone wants it,
give me a yell so I can put some disclaimers on the top ("it works for
me").

> Mark.

Yours,
-- 
Peter Barker                          |   N    _--_|\ /---- Barham, Vic 
Programmer,Sysadmin,Geek              | W + E /     /\                
pbarker at barker.dropbear.id.au         |   S   \_,--?_*<-- Canberra      
You need a bigger hammer.             |             v    [35S, 149E]   
qq%I've never heard of it or used it, apart from finding it in the Camel
 book and saying "Oh god".% -- Onceler






More information about the linux mailing list