JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Adding and Updating Oracle Solaris 11.1 Software Packages     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Introduction to the Image Packaging System

2.  IPS Graphical User Interfaces

3.  Getting Information About Software Packages

Showing Package Install State Information

Displaying Package Descriptions or Licenses

Showing Information from the Package Manifest

Listing Files Installed by a Package

Listing All Installable Packages in a Group Package

Displaying License Requirements

Searching for Packages

Identifying Which Package Delivers a Specific File

Showing Which Packages Provide Which SMF Services

Listing Packages by Category

Showing Dependent Packages

Listing All Packages in a Group Package

4.  Installing and Updating Software Packages

5.  Configuring Installed Images

Searching for Packages

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, query is interpreted as a series of terms to be 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 use single or double quotation marks to search for phrases. Be sure to take your shell into account when you use wildcards or quotation marks.

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:

pkg_name:action_name:index:token

Missing fields are implicitly wildcarded. The pkg_name and token fields can include explicit wildcards. The action_name and index values must match exactly. The value of action_name is the name of an action. The value of index is the name of an attribute of the action. See “Actions” in the pkg(5) man page for a list of package actions and attributes. Not all attributes are searchable. For example, mode is an attribute of the file action, but mode is not a valid value for index. Some values of index are values derived from other attributes. For example, index can be basename, which is the last component of the path attribute of a file or dir action. Examples of useful values for index include basename and path for file and dir actions, the dependency type (require or group, for example) for depend actions, and driver_name and alias for driver actions..

In general, the value of token is compared with the value of the attribute named by index. For example, in the following partial driver action, alias is an attribute name that could be specified for index, and pci108e could be specified for token.

driver alias=pci108e,1647 alias=pci108e,16a7

The syntax of a set action is slightly different. The two attributes of a set action are name and value. In this case, the value of index is the value of a name attribute, and the value of token is compared with the value of the matching value attribute. For example, in the following partial set action, pkg.summary could be specified for index, and Broadcom could be specified for token.

set name=pkg.summary value="Broadcom 57xx 1GbE NIC Driver"

Some well defined values of set action name attributes include pkg.fmri, info.classification, pkg.description, and pkg.summary. See “Set Actions” in the pkg(5) man page.

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.

By default, results are displayed for all matching actions, which can yield multiple lines of results for one package. Use the -p option to list each matching package only once.

Identifying Which Package Delivers a Specific File

The following examples show that the libpower library came from the system/kernel/power package.

$ pkg search -Hlo pkg.name /lib/libpower.so.1
system/kernel/power
$ pkg search -lo path,pkg.name libpower.so.1
PATH              PKG.NAME
lib/libpower.so.1 system/kernel/power
$ pkg search -Hlo path,pkg.name basename:libpower.so.1
lib/libpower.so.1 system/kernel/power
$ pkg search -Hlo path,pkg.name 'path:*libpower.so.1'
lib/libpower.so.1 system/kernel/power

Showing Which Packages Provide Which SMF Services

To show which packages provide a particular SMF service, search for the name of the service as the value of the org.opensolaris.smf.fmri attribute.

$ pkg search -o value,pkg.name 'org.opensolaris.smf.fmri:*network/http*'
VALUE                                                 PKG.NAME
['svc:/network/http', 'svc:/network/http:apache22']   web/server/apache-22
['svc:/network/http', 'svc:/network/http:tomcat6']    web/java-servlet/tomcat
['svc:/network/http', 'svc:/network/http:squid']      web/proxy/squid
['svc:/network/http', 'svc:/network/http:lighttpd14'] web/server/lighttpd-14

In this case, each attribute has two values: the service name with and without the instance name specified. The following example shows how this attribute is specified in the package manifest:

set name=org.opensolaris.smf.fmri value=svc:/network/http value=svc:/network/http:apache22

Listing Packages by Category

The following example identifies all packages that have “Source Code Management” in the value of their info.classification attribute.

$ pkg search 'info.classification:source code management'
INDEX               ACTION VALUE                              PACKAGE
info.classification set    Development/Source Code Management pkg:/developer/versioning/sccs@0.5.11-0.175
info.classification set    Development/Source Code Management pkg:/developer/xopen/xcu4@0.5.11-0.175.1.0.
info.classification set    Development/Source Code Management pkg:/developer/versioning/git@1.7.9.2-0.175
info.classification set    Development/Source Code Management pkg:/developer/versioning/mercurial-27@2.2.
info.classification set    Development/Source Code Management pkg:/library/python-2/subversion@1.7.5-0.17
info.classification set    Development/Source Code Management pkg:/developer/versioning/mercurial-26@2.2.
info.classification set    Development/Source Code Management pkg:/library/java/subversion@1.7.5-0.175.1.
info.classification set    Development/Source Code Management pkg:/developer/quilt@0.60-0.175.1.0.0.21.0
info.classification set    Development/Source Code Management pkg:/developer/versioning/cvs@1.12.13-0.175
info.classification set    Development/Source Code Management pkg:/developer/versioning/subversion@1.7.5-
info.classification set    Development/Source Code Management pkg:/developer/versioning/mercurial@2.2.1-0
info.classification set    Development/Source Code Management pkg:/library/perl-5/subversion@1.7.5-0.175.

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 -Ho pkg.name 'info.classification:source code management'
developer/versioning/sccs
developer/xopen/xcu4
developer/versioning/git
developer/versioning/mercurial-27
library/python-2/subversion
developer/versioning/mercurial-26
library/java/subversion
developer/quilt
developer/versioning/cvs
developer/versioning/subversion
developer/versioning/mercurial
library/perl-5/subversion

Showing Dependent Packages

These examples show the packages that are dependencies of 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 -Hlo pkg.name require:system/kernel/power
system/kernel/dynamic-reconfiguration/i86pc
system/hal

The following example shows that many packages have an exclude dependency on pkg:/x11/server/xorg@1.12.99.

$ pkg search -lo pkg.name,fmri 'depend:exclude:*xorg*'
PKG.NAME                                     FMRI
x11/server/xvnc                              pkg:/x11/server/xorg@1.12.99
x11/server/xorg                              pkg:/x11/server/xorg@1.12.99
x11/server/xorg/driver/xorg-video-mga        pkg:/x11/server/xorg@1.12.99
x11/server/xorg/driver/xorg-video-vesa       pkg:/x11/server/xorg@1.12.99
x11/server/xorg/driver/xorg-input-vmmouse    pkg:/x11/server/xorg@1.12.99 
...

Listing All Packages in a Group Package

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 default installation manifest for non-global zones installs the solaris-small-server group package. The solaris-small-server group package is also 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 -Hfo fmri '*/solaris-large-server:depend:group:*'
archiver/gnu-tar
compress/bzip2
...
text/texinfo
web/wget

In this example, -o pkg.name would return only the name of the package specified in the pkg_name field of the query:

group/system/solaris-desktop

The -o fmri option returns the FMRI of the packages that are specified in the solaris-large-server 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.