Displaying Information that is not a Path

To display information that is not a path or to display a subset of path information, use the -t, -a, and -o options of the pkg contents command.

The -t option specifies the type of action to select, such as file, link, or depend. See the pkg(7) man page for a list of package actions. You can specify multiple action types in a comma-separated list, or you can specify the -t option multiple times. When you use the -t option, the default output are the values of the key attributes for that action.

The -a option specifies which attribute values of the action to select. See the pkg(7) man page for a list of attributes of each action type. You can specify the -a option multiple times.

The -o option specifies the output to display. You can specify the name of an attribute as described for the -a option or any of several pseudo attribute names listed in the pkg(1) man page. You can specify multiple attribute arguments in a comma-separated list, or you can specify the -o option multiple times. Each -o argument is one column of output.

Example 2-1 Displaying Attributes of Files Installed by a Package

This example displays additional attributes of the paths listed in the example in Listing Files Installed by a Package.

$ pkg contents -o owner,group,mode,path zip
OWNER GROUP MODE PATH
root  bin   0555 usr/bin/zip
root  bin   0555 usr/bin/zipcloak
root  bin   0555 usr/bin/zipnote
root  bin   0555 usr/bin/zipsplit
root  bin   0444 usr/share/man/man1/zip.1
root  bin   0444 usr/share/man/man1/zipcloak.1
root  bin   0444 usr/share/man/man1/zipnote.1
root  bin   0444 usr/share/man/man1/zipsplit.1

The default output displayed if the -o option is not specified is values of path attributes. The following output shows that the oracle-rdbms-server-18c-preinstall package does not deliver any files, links, or directories directly.

$ pkg contents -r oracle-rdbms-server-18c-preinstall
pkg: This package delivers no filesystem content, but may contain metadata. Use
the -o option to specify fields other than 'path', or use the -m option to show
the raw package manifests.

All of the following commands show that the oracle-rdbms-server-12-1-preinstall package has set, signature, and depend actions:

$ pkg contents -rm oracle-rdbms-server-18c-preinstall
$ pkg contents -ro action.name oracle-rdbms-server-18c-preinstall
$ pkg contents -ro action.raw oracle-rdbms-server-18c-preinstall

Example 2-2 Specifying an Action Type

The following command displays the dependency type and package name of each dependency in the oracle-rdbms-server-18c-preinstall package:

$ pkg contents -rt depend oracle-rdbms-server-18c-preinstall
TYPE    FMRI
group   system/header
group   system/kernel/oracka
group   system/picl
group   x11/diagnostic/x11-info-clients
group   x11/library/libxi
group   x11/library/libxtst
group   x11/session/xauth
require compress/unzip
require developer/assembler
require developer/build/make
require system/dtrace
require system/library/openmp

Example 2-3 Specifying Action Attributes

If you are only interested in some of the dependencies, use the -a option to narrow the selection.

$ pkg contents -rt depend -a fmri='*lib*' oracle-rdbms-server-18c-preinstall
TYPE    FMRI
group   x11/library/libxi
group   x11/library/libxtst
require system/library/openmp

By default, output is sorted by path or by the first attribute specified by the -o option. You can use the -s option to specify a different attribute as the sort key. The -s option can be specified multiple times.

In the following command, the specified attributes are unique to the set action, and you do not need to specify the set action type:

$ pkg contents -ra name=pkg.summary -a name=pkg.description -o name,value -s value oracle-rdbms-server-18c-preinstall
NAME            VALUE
pkg.summary     Prerequisite package for Oracle Database 18c
pkg.description Provides the set of Oracle Solaris packages required for installation and operation of Oracle Database 18c.

If you do specify the set action type, then you do not need to specify the output columns because name and value are the default output for set actions:

$ pkg contents -rt set -a name=pkg.summary -a name=pkg.description -s value oracle-rdbms-server-18c-preinstall

Example 2-4 Displaying All Links Involved in a Mediation

The following command shows the path and target of links that participate in the python mediation delivered by the python-35 package. See Specifying a Default Application Implementation for information about mediations of multiple versions.

$ pkg contents -a mediator=python -o path,target python-35
PATH                                 TARGET
usr/bin/2to3                         2to3-3.5
usr/bin/idle                         idle3.5
usr/bin/pydoc                        pydoc3.5
usr/bin/python                       python3.5
usr/bin/python-config                python3.5-config
usr/bin/pyvenv                       pyvenv-3.5
usr/lib/pkgconfig/python3.pc         python-3.5.pc
usr/lib/sparcv9/pkgconfig/python3.pc python-3.5.pc
usr/share/man/man1/python3.1         python3.5.1

Example 2-5 Displaying Other File System Objects and Attributes

The following example shows the path and target of links installed by the specified packages. In addition to the attributes shown in the pkg(7) man page, several pseudo attributes are available to use. See the pkg(1) man page for a list of pseudo attributes.

In the following example, the pkg.name pseudo attribute shows the name of the package that delivers the specified action. In this example, Python 2.7.14, Python 3.4.6, and Python 3.5.3 are installed, and the command shows the path to use to access the specific version if you do not want to rely on the /usr/bin/python link. See also Specifying a Default Application Implementation for information about mediations of multiple versions.

$ pkg contents -t link -a path=usr/bin/python -o path,target,pkg.name
PATH           TARGET    PKG.NAME
usr/bin/python python2.7 runtime/python-27
usr/bin/python python3.4 runtime/python-34
usr/bin/python python3.5 runtime/python-35