|Skip Navigation Links|
|Exit Print View|
|Adding and Updating Oracle Solaris 11 Software Packages Oracle Solaris 11 Information Library|
Use the pkg search command to search for packages whose data matches the specified pattern.
/usr/bin/pkg search [-HIaflpr] [-o attribute ...] [-s repo_uri] query
Like the pkg contents command, the pkg search command examines the contents of packages. While the pkg contents command returns the contents, the pkg search command returns the names of packages that match the query.
By default, pkg search query terms are matched exactly except for case. Use the -I option to specify a case-sensitive search. You can use ? and * wildcards in query terms.
You can specify more than one query term. By default, multiple terms are joined with AND. You can explicitly join two terms with OR.
Queries can be expressed in the following structured form:
Missing fields are implicitly wildcarded. Explicit wildcards are supported in the pkg_name and token fields. The action_type and key must match exactly. See the pkg(5) man page for a list of package actions and keys.
By default, repositories associated with all publishers configured for this image are searched. Use the -l option to search only packages that are installed in this image. Use the -s option to specify the URI of the repository to search.
By default, matches are displayed only for currently installed or newer package versions. Use the -f option to display all matched versions.
The following example shows that the libpower library came from the system/kernel/power package.
$ pkg search -l -H -o pkg.name /lib/libpower.so.1 system/kernel/power
The following example identifies all packages that have “Source Code Management” in the value of their info.classification attribute.
# pkg search ':set:info.classification:Source Code Management' INDEX ACTION VALUE PACKAGE info.classification set Development/Source Code Management pkg:/firstname.lastname@example.org info.classification set Development/Source Code Management pkg:/email@example.com info.classification set Development/Source Code Management pkg:/firstname.lastname@example.org info.classification set Development/Source Code Management pkg:/email@example.com info.classification set Development/Source Code Management pkg:/firstname.lastname@example.org info.classification set Development/Source Code Management pkg:/email@example.com info.classification set Development/Source Code Management pkg:/firstname.lastname@example.org. info.classification set Development/Source Code Management pkg:/email@example.com info.classification set Development/Source Code Management pkg:/firstname.lastname@example.org info.classification set Development/Source Code Management pkg:/email@example.com
This example shows a large amount of repeated information that obscures the information that was really wanted.
The following example uses the -o option to show only the names of the packages and uses the -H option to omit the column heading.
# pkg search -o pkg.name -H ':set:info.classification:Source Code Management' developer/versioning/subversion developer/versioning/git developer/versioning/sccs library/perl-5/subversion library/java/subversion library/python-2/subversion developer/xopen/xcu4 developer/quilt developer/versioning/cvs developer/versioning/mercurial
These examples show the packages that depend on the specified package.
The following example shows packages that have a require dependency on the system/kernel/power package. If you used the pkg contents command to display depend actions of type require for the i86pc and system/hal packages, you would see that system/kernel/power is listed for both packages.
$ pkg search -l -H -o pkg.name 'depend:require:system/kernel/power' system/kernel/dynamic-reconfiguration/i86pc system/hal
The following example shows that many packages have an exclude dependency on pkg:/firstname.lastname@example.org.
$ pkg search -l -o pkg.name,fmri 'depend:exclude:' PKG.NAME FMRI x11/server/xorg/driver/xorg-video-ati pkg:/email@example.com x11/server/xorg/driver/xorg-video-intel pkg:/firstname.lastname@example.org x11/server/xvnc pkg:/email@example.com desktop/remote-desktop/tigervnc pkg:/firstname.lastname@example.org x11/server/xserver-common pkg:/email@example.com ...
The Oracle Solaris 11 GUI installer installs the solaris-desktop group package. The text installer and the default AI manifest in an Automated Installer installation install the solaris-large-server group package. The solaris-small-server group package is an alternative you can use to install a smaller set of packages on a server. You can use the following search form to display the set of packages that is included in each group.
$ pkg search -o fmri -H '*/solaris-desktop:depend:group:' archiver/gnu-tar audio/audio-utilities ...
In this example, -o pkg.name would return only the name of the package specified in the pkg_name field of the query:
The -o fmri option returns the FMRI of the packages that are specified in the solaris-desktop package as group type dependencies.
By default, search returns only packages that are installable in this image. In this example, search is not returning matching packages but rather is returning the value of an attribute of an action in a specified package. That attribute value happens to be a package name in this example. The number of results from this command is larger than the number of the results from the similar pkg contents command because these search results include the names of all packages that are named in group depend actions in the specified package, not just installable packages. For example, package variants might be included that are not installable in this image. Compare the output from this search to the output from the pkg contents command shown in Listing All Installable Packages In a Group Package.
Tip - In general, use the pkg contents command to show the contents of a specified package, and use the pkg search command to show packages that match a query. If you know which package delivers the content that you are interested in, use the pkg contents command.