什么进程在UNIX上使用哪些端口? [英] What processes are using which ports on unix?
问题描述
我需要找出哪些端口连接到Unix计算机(HP Itanium)上的哪些进程。不幸的是, lsof
没有安装,我没有办法安装它。
有没有人知道另一种方法?
假设这是HP-UX? Ptools 的用法 - 你有那些安装?如果是这样,您可以使用pfiles找到应用程序正在使用的端口:
如果文件描述符对应于一个文件,则pfiles打印fstat(2)
和fcntl(2)信息。
如果文件描述符对应一个套接字,则pfiles打印socket
相关信息,例如套接字类型,套接字族和协议族。
在AF_INET和AF_INET6系列套接字的情况下,也打印对等主机的信息
。
for f in $(ps -ex | awk'{print $ 1}'); do echo $ f; pfiles $ f | grep PORTNUM; done
为端口号切换PORTNUM。 :)可能是孩子pid,但让你足够接近以识别问题的应用程序。
I need to find out what ports are attached to which processes on a Unix machine (HP Itanium). Unfortunately, lsof
is not installed and I have no way of installing it.
Does anyone know an alternative method? A fairly lengthy Googling session hasn't turned up anything.
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 f in $(ps -ex | awk '{print $1}'); do echo $f; pfiles $f | grep PORTNUM; done
switch PORTNUM for the port number. :) may be child pid, but gets you close enough to identify the problem app.
这篇关于什么进程在UNIX上使用哪些端口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!