Equivalent lsof -i in Solaris

I have a fast question. I want to know what is the losf -i equivalent command in a Solaris system.

I only want to show the files with network connection.

Thank you!!


Here is a shell script that list all processes having open TCP or UDP ports on Solaris, you can limit it to a given port number by passing it as an argument:

pfiles /proc/* 2>/dev/null | nawk -v port=$1 ' /^[0-9]/ { cmd=$2; type="unknown"; continue } $1 == "SOCK_STREAM" { type="tcp" } $1 == "SOCK_DGRAM" { type="udp" } $2 ~ "AF_INET" { if((port!="")&&($5!=port)) continue; if(cmd!="") { printf("%s\n",cmd); cmd="" } printf(" %s:%s/%s\n",$3,$5,type); }'

Note: As documented in the warning section of the pfiles manual page, it is not recommended to run this command on a heavily loaded production system with a time sensitive process running as deadlocks or crashes might happen.


As of Solaris 11.2 this type of information is now available directly in the netstat command (-u option) so you don't have to use the pfiles hack for the purpose or use the lsof tool. Personally I've always wondered by this information could not be part of the netstat output so glad to see that'll finally be the case.

There's a nice blog from Oracle on the topic.

(caveat: at the time of writing v11.2 is in beta but fully disclosed as to the contents / new features)


you can try pfiles,fuser. you can install lsof on solaris.


人吐槽 人点赞



用户名: 密码:
验证码: 匿名发表


查看评论:Equivalent lsof -i in Solaris