12611

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!!

Answer1:

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.

Answer2:

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)

Answer3:

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

http://andriigrytsenko.net/2010/08/lsof-installation-on-solaris-10/

Recommend

  • Open readme.txt at end of installatin failed in WiX
  • error LGHT0204 : ICE57: Component 'XXX' has both per-user data and a keypath that can be e
  • import error with python-mysql-connector 1.16, django 1.6, and python 3.2.3
  • Django and Heroku: Static files work with 'foreman start' but not './manage.py runser
  • How can you tell if a Python program has anything to read from stdin?
  • Development workflow for server and client using Docker Compose?
  • getting domain details and portrait_id and landscape_id for openX
  • View Paypal shopping cart contents on my site
  • Java: java.util.ConcurrentModificationException
  • Boost binary serialization doesn't work occasionally. The parsed data is corrupted sometimes
  • composer dependency stating in doesn't have php-xsl
  • Checking a play current mode makes an error occur
  • How to make stdcall from Go
  • How can I see a list of all files that are different between two Hg repositories?
  • Timeout a query
  • Appium MobileElement swipe returns unknown server error
  • How to enable large page memory for the JVM?
  • How to implement Deep Linking in Roku SG application?
  • using html data-attributes as css-variable (i.e. text-shadow)
  • Building Qt project for C++11 standard
  • VSCode change debug shell to bash on windows
  • Error processing multiple files
  • perl, mysql - fasting way to upload a csv file into mysql?
  • Installing iPhone App to iPhone
  • why do I get the error when installing the gem 'pg'? [duplicate]
  • FileReader+canvas image loading problem
  • Why value captured by reference in lambda is broken? [duplicate]
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Illegal mix of collations for operation for date/time comparison
  • R: gsub and capture
  • Arrays break string types in Julia
  • Linker errors when using intrinsic function via function pointer
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • How do I configure my settings file to work with unit tests?
  • Change div Background jquery
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • LevelDB C iterator
  • Binding checkboxes to object values in AngularJs
  • How can i traverse a binary tree from right to left in java?