Identifying Which Package Delivers a Specified File

In the following example, the search token is the full path of a file system object:

$ pkg search /lib/libinetutil.so.1
INDEX      ACTION VALUE                PACKAGE
path       file   lib/libinetutil.so.1 pkg:/system/library@11.4-11.4.0.0.1.10.1

The pkg search command searches package actions. The preceding command found the search token in the path attribute of a file action and shows that this file is delivered by the system/library package.

The following example specifies that the desired output is only the name of the package. Specifying the -l option can quicken the search because only installed packages are searched:

$ pkg search -Hlo pkg.name '*libinetutil*'
system/library

If you do not specify the output you want, then using just the base name of the file as the search token, or using wild cards as shown above, shows that this file is delivered to six different directories and is the target of three links. Another way to show each package name only one time, instead of showing many lines of output for one package, is to use the -p option or enclose the search token in angle brackets. Depending on your shell, you might need to escape the angle brackets. The following commands have the same output:

$ pkg search -p '*libinetutil*'
$ pkg search \<'*libinetutil*'\>
PACKAGE                                  PUBLISHER
pkg:/system/library@11.4-11.4.0.0.1.10.1 solaris

The -p option of the pkg verify command also tells you which package delivers a named file. In this case, you must specify the full path to the file relative to /:

$ pkg verify -vp lib/libinetutil.so.1
PACKAGE                                                                 STATUS
pkg://solaris/system/library                                                OK

If you cannot find the package that delivers a file on your system, perhaps that file is not packaged. See the -p and --unpackaged options of the pkg verify command in Identifying Unpackaged File System Content.