Unix administration - Quick question

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > January 2004 > Quick question





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Quick question
tvr

2004-01-23, 4:54 pm

Hi,

Is there any command to know which application/program is listening
on a given socket.

For example, some daemons are running on the current system.
I want to know what application is listening on socket 1234.

Is this possible??

Thanks in advance.
tvr1729
Bit Twister

2004-01-23, 4:54 pm

On 15 Nov 2003 18:21:06 -0800, tvr wrote:
quote:

> Hi,
>
> Is there any command to know which application/program is listening
> on a given socket.
>
> For example, some daemons are running on the current system.
> I want to know what application is listening on socket 1234.
>
> Is this possible??




netstat -ta # maybe
tvr

2004-01-23, 4:54 pm

Bit Twister <BitTwister@localhost.localdomain> wrote in message news:<slrnbrdnoi.6ks.BitTwister@wb.home>...
quote:

> On 15 Nov 2003 18:21:06 -0800, tvr wrote:
>
>
> netstat -ta # maybe



Nestat displays all the ports...
I want a specific port.

tvr
Bit Twister

2004-01-23, 4:54 pm

On 16 Nov 2003 18:20:02 -0800, tvr wrote:
quote:

>
> Nestat displays all the ports...
> I want a specific port.



Then pipe it through grep.
Andrew Jury

2004-01-23, 4:54 pm

Hi,

Try the Open Source command 'lsof'. If you don't have it get it here:

http://freshmeat.net/projects/lsof/

If you are working on Solaris 5.8 > then 'pfiles' is a good choice, however
you will have to filter the output to get the info you need in this case.

--- aj ---

"tvr" <tvr1729@yahoo.com> wrote in message
news:6f4d9f70.0311151821.1cd060bd@posting.google.com...
quote:

> Hi,
>
> Is there any command to know which application/program is listening
> on a given socket.
>
> For example, some daemons are running on the current system.
> I want to know what application is listening on socket 1234.
>
> Is this possible??
>
> Thanks in advance.
> tvr1729




Ulrich Herbst

2004-01-23, 4:54 pm

tvr1729@yahoo.com (tvr) writes:
quote:

> Bit Twister <BitTwister@localhost.localdomain> wrote in message news:<slrnbrdnoi.6ks.BitTwister@wb.home>...
>
> Nestat displays all the ports...
> I want a specific port.
>


Use netstat -ta | grep xxx

But I think that is different for different Unixes.

For Linux, that is netstat -anp | grep 1234
and you can just list your own processes or you have to be root.

There are some unixes without such a command.

Install and try lsof or fuser.

Uli

--
'''
(0 0)
+------oOO----(_)--------------+
| |
| Ulrich Herbst |
| |
| Tel. ++49-7271-940775 |
| |
| Ulrich.Herbst@gmx.de |
+-------------------oOO--------+
|__|__|
|| ||
ooO Ooo
tvr

2004-01-23, 4:54 pm

Ulrich Herbst <ulrich.herbst@gmx.de> wrote in message news:<877k1zgc2h.fsf@pculi.herbst.fam>...
quote:

> tvr1729@yahoo.com (tvr) writes:
>
> Use netstat -ta | grep xxx
>
> But I think that is different for different Unixes.
>
> For Linux, that is netstat -anp | grep 1234
> and you can just list your own processes or you have to be root.
>
> There are some unixes without such a command.
>
> Install and try lsof or fuser.
>
> Uli
>



Guys,

I am familiar with piping and tried that earlier.
Netstat give some stream information
but not the actual process that is listening.

I dont know about others but in solaris it is giving out stream information
for example:

host:~ > netstat -a | grep 8001
3003c3ba8d8 stream-ord 300116d0e50 00000000 8001

So you see, I cant make out what the process is.

Anyway, thanks for the replies
tvr
Flip

2004-01-23, 4:54 pm

> So you see, I cant make out what the process is.
I'm a newbie to linux so maybe I'm off the mark here, but I found the -p
returns the name of the program on that port. It seems like you netstat
installed cause you're getting stuff back, what do the man pages say for
programs?


tvr

2004-01-23, 4:54 pm

"Flip" <[remove]phenry_w@hotmail.com> wrote in message news:<eP4vb.5658$G1.26726@tor-nn1.netcom.ca>...
quote:

> I'm a newbie to linux so maybe I'm off the mark here, but I found the -p
> returns the name of the program on that port. It seems like you netstat
> installed cause you're getting stuff back, what do the man pages say for
> programs?




Man pages say,
-p is used to "Show the net to media tables."

Thanks
tvr
Andy Hibbins

2004-01-23, 4:54 pm

tvr wrote:
quote:

> Man pages say,
> -p is used to "Show the net to media tables."



Have you got lsof? If so this may show what program is using the socket
you mention, "lsof -n -i" may be what you need.

---
Money can't buy happiness, but allows a choice of misery.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com