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

Re: Netstat port list v/s PID



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hantzley <hantzley@intnet.mu> wrote:
> Is there a way to know to which process belong a particular port?
> e.g., port 32773 - 32779, are known to be for rpc services. But to
> which process do they pertain to, that's another issue?

First, read through lsof(8). This is a fabulous tool, but it's still a
bit obscure for me, so I'm not the expert here. But, this should do
the job:

	# lsof -i

# means root prompt, of course. This will give you listing of all
processes, but if you want to be more accurate, try this:

	# lsof -i 4tcp@<hostname>:<port>

At least it works nicely here. Let's say, that I don't know what's
listening on port 783 and I want to find out; I'll do this:

	$ sudo lsof -i 4tcp@erpland:783
	COMMAND PID USER   FD   TYPE DEVICE SIZE NODE NAME
	spamd   390 root    3u  IPv4    579       TCP erpland:783 (LISTEN)

So, I guess this is the tool you were looking for. 

> Thank you,

HTH!

- -- 
Jussi Ekholm <ekhowl@goa-head.org> | <http://erppimaa.ihku.org/> | <0x1410081E>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9pd2LAtEARxQQCB4RAqToAJ9f5kSVEHtuRciVGjufFooylsHitgCgklBC
wkY3RfyPgPOjfiHT8xOG+Ds=
=tyYM
-----END PGP SIGNATURE-----



Reply to: