How to install pkg lsof in Solaris 11?

hi downloaded the pkg and installed the pkg from root user .But still when i run command lsof and man lsof .No command found is the error. I tried by pkgadd -d (.pkg file). Please help me

---------- Post updated at 12:44 PM ---------- Previous update was at 12:41 PM ----------

This is what i done from root user in /root path

 pkgadd -d lsof.4.87.SPARC.64bit.Solaris.11.pkg

The following packages are available:
  1  lsof     lsof 4.87 SPARC 64bit Solaris 11
              (sparc) 4.87

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: all

Processing package instance <lsof> from </root/lsof.4.87.SPARC.64bit.Solaris.11.pkg>

lsof 4.87 SPARC 64bit Solaris 11(sparc) 4.87

This appears to be an attempt to install the same architecture and
version of a package which is already installed.  This installation
will attempt to overwrite this package.

Victor A. Abell
## Executing checkinstall script.
Using </> as the package base directory.
## Processing package information.
## Processing system information.
   7 package pathnames are already properly installed.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.

The following files are being installed with setuid and/or setgid
permissions:
*/usr/local/bin/lsof <setgid sys>

* - overwriting a file which is also setuid/setgid.

Do you want to install these as setuid/setgid files [y,n,?,q] y

Installing lsof 4.87 SPARC 64bit Solaris 11 as <lsof>

## Installing part 1 of 1.
[ verifying class <none> ]

Installation of <lsof> was successful.
You have new mail in /var/mail/root
root:~# lsof
-bash: lsof: command not found

Run the command with the full path or add the path to your PATH variable in your shell.

you have a $PATH issue. it's already installed.

do a

locate lsof

and then run it with the whole path or update your $PATH in your profile to include the locate that contains it.

EDIT: it's /usr/local/bin/lsof

When i run this command i got

root:~# locate lsof
/lib/llib-lsoftcrypto
/lib/llib-lsoftcrypto.ln
/lib/sparcv9/llib-lsoftcrypto.ln
/usr/lib/llib-lsoftcrypto
/usr/lib/llib-lsoftcrypto.ln
/usr/lib/sparcv9/llib-lsoftcrypto.ln
/usr/share/zsh/5.0.5/functions/Completion/Unix/_lsof
/usr/share/zsh/5.0.5/functions/Completion/Unix/_xmlsoft

please help

There are two posts with the answer to your question... Read everything, act accordingly and if you still have problems, report back with an update.

Thanks Duke..I think installation is not done completely. I cannot find my lsof command in bin..The issue still persists..

Did you check in /usr/local/bin ?

1 Like

Your system may have GNU utilities ( lsof is one) somewhere special.
Try the command:

which gawk

This will probably fail because your PATH variable is wrong.
So then try

find /usr -type f -name lsof

Example output might be:

/usr/sfw/bin/gawk

gawk is a GNU version of awk for Solaris - pick something else if you know one. like ggrep ...

Following this example then you would use this command:

ls -l  /usr/sfw/bin/gawk

Do you know where GNU coreutils and friends are on your Solaris system? lsof is in there.

Note that lsof is not part of the GNU utilities, it is not even distributed under the GPL.

It is also very specific in the sense it uses undocumented and somewhat hackish methods to access private kernel structures. For this reason, it needs to be adapted each time these structures evolve and older binaries refuse to work on newer kernels.

To avoid such issues, it is recommended to use the bundled pfiles, netstat, and other supported utilities.

1 Like