Adding and Updating Software in Oracle® Solaris 11.2

Exit Print View

Updated: July 2014
 
 

Specifying the Search Query

By default, the search query is 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.

Search queries can be expressed in the following structured form:

package:action:index:token
package

The name of the package to search or a pattern that might match multiple packages.

action

The name of an action listed in the “Actions” section in the pkg(5) man page.

index

The name of an attribute of action as listed in the “Actions” section of the pkg(5) man page.

token

The value of index or a pattern that might match the value of index.

Missing fields are implicitly wildcarded.

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.

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. The following example show a partial set action for a driver package:

set name=pkg.summary value="Broadcom NetXtreme II 10GbE NIC Driver"

The following example specifies set for the action, pkg.summary for index, and Broadcom for token. The search.match and pkg.name column specifiers are pseudo attributes. See the pkg(1) man page.

$ pkg search -o search.match,pkg.name pkg.summary:Broadcom
SEARCH.MATCH                           PKG.NAME
Broadcom NetXtreme II 10GbE NIC Driver driver/network/ethernet/bnxe
Broadcom 57xx 1GbE NIC Driver          driver/network/ethernet/bge
Broadcom NetXtreme II 1GbE NIC Driver  driver/network/ethernet/bnx
Broadcom BCM4401 NIC Driver            driver/network/ethernet/bfe
Broadcom HT1000 SATA driver            driver/storage/bcm_sata

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, 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.