查找 Solaris 中进程正在侦听的所有端口

Find all ports a process in Solaris is listening to

我需要列出 Solaris 中进程正在侦听的所有端口(类似于 Linux 中的 'lsof -i -P')。不幸的是 lsof 命令不起作用,我也无法安装它。有什么选择吗?我尝试了一些 netstat 命令,但没有显示端口或 pid。

使用pfiles

pfiles

Report fstat(2) and fcntl(2) information for all open files in each process. For network endpoints, the local (and peer if connected) address information is also provided. For sockets, the socket type, socket options and send and receive buffer sizes are also provided. In addition, a path to the file is reported if the information is available from /proc/pid/path. This is not necessarily the same name used to open the file. See proc(4) for more information.

使用命令 pfiles 的一个不错的脚本: http://www.oracle.com/technetwork/systems/security/pcp-149863.txt

文斯