Hi there,
I need to find out what ports are attached to which processes on a unix machine (HP Itanium). Unfortunately, the lsof is not installed and I have no way of installing it.
Does anyone know an alternative method? A fairly lengthy google hasn't turned up anything.
Thanks.
-
netstat -l (assuming it comes with that version of UNIX)
From David Dorward -
Try "pfiles PID" to show all open files for a process.
From dogbane -
I know FreeBSD has
sockstat
.ΤΖΩΤΖΙΟΥ : lsof is unavailable.Tim Sally : Ack, it's late :-pFrom Tim Sally -
Given (almost) everything on unix is a file, and lsof lists open files...
Linux : netstat -putan or lsof | grep TCP
OSX : lsof | grep TCP
Other Unixen : lsof way...
ΤΖΩΤΖΙΟΥ : Please read the question: lsof is unavailable.From lms -
netstat -pln
EDIT: linux only, on other UNIXes netstat may not support all these options.
From Sergei Stolyarov -
netstat -ln | awk '/^(tcp|udp)/ { split($4, a, /:/); print $1, a[2]}' | sort -u
gives you the active tcp/udp ports. Then you can use the ports with
fuser -n tcp
orfuser -n udp
, as root, and supposing thatfuser
is GNU fuser or has similar options.If you need more help, let me know.
From ΤΖΩΤΖΙΟΥ -
Assuming this is HP-UX? What about the Ptools - do you have those installed? If so you can use "pfiles" to find the ports in use by the application:
pfiles prints information about all open file descriptors of a process. If file descriptor corresponds to a file, then pfiles prints the fstat(2) and fcntl(2) information.
If the file descriptor corresponds to a socket, then pfiles prints socket related info, such as the socket type, socket family, and protocol family.
*In the case of AF_INET and AF_INET6 family of sockets, information about the peer host is also printed.*
For example, see http://www.theunixblog.com/2007/01/find-out-which-process-is-using-port.html
From Jay -
Thanks all for your input. My main problem here is that I don't have permissions on the box to install anything. I've managed to solve my specific problem anyway.
mattlant : You should answer your question then so that others who end up reading this with same or similar problem may be able to use th einfo.gnuchu : Yeah, I normally would have done that but in this case my solution won't answer the question I asked.Neer : Probably if you have found a work around that would help others looking for answers....From gnuchu
0 comments:
Post a Comment