Which package delivers the file/directory I can not find?

Back in the day (ahem, Solaris 10 and earlier...) you could use a command like the following to figure out which package was responsible for; e.g.; "/usr/include/math.h", or any other "include/math.h", just in case it is somewhere less obvious:

mashie$ fgrep include/math.h /var/sadm/install/contents
/usr/include/math.h f none 0644 root bin 10514 7356 1249334889 SUNWlibm

In other words, /var/sadm/install/contents was a flat-file index of every file, directory, link, etc. installed on the system. The last field is the package name - "SUNWlibm" in this case.

Things are a little more tricky with the new packaging system in Solaris 11 Express. Here is the equivalent "pkg contents" command:

mashie$ pkg contents -o pkg.name,path -a path='\*/include/math.h'
system/library/math/header-math usr/include/math.h

Join the discussion

Comments ( 3 )
  • Gary Riseborough Wednesday, December 8, 2010

    hi Tim,

    How about with less typing :

    # pkg search '\*/include/math.h'


    path file usr/include/math.h pkg:/system/library/math/header-math@0.5.11-

    (The above finds the package that has the include/math.h file. The package \*may\* be installed, or it might not be)

    # pkg info header-math

    pkg: info: no packages matching the following patterns you specified are

    installed on the system. Try specifying -r to query remotely:


    (Package isn't installed locally)

    # pkg info -r header-math

    Name: system/library/math/header-math

    Summary: Math & Microtasking Library Headers & Lint Files

    Description: Math & Microtasking Library Headers & Lint Files

    Category: System/Libraries

    State: Not installed

    Publisher: solaris

    Version: 0.5.11

    Build Release: 5.11


    Packaging Date: Fri Nov 05 06:11:39 2010

    Size: 171.31 kB

    FMRI: pkg://solaris/system/library/math/header-math@0.5.11,5.11-

    (Package information pulled from the repository)


    -- Gary

  • Sean Thursday, December 9, 2010

    Doesn't "pkg search" do what you want to do?

  • xtrondo Wednesday, December 15, 2010

    For old days isn't better just use: pkgchk -l -P math.h ?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.