The pkg contents command displays the file system content of packages. With no options or operands, this command displays path information for all packages that are installed in the current image. Use command options to specify particular package content to display. To narrow your results, provide one or more package names. You can use wildcards in the package names. Quote the wildcards so that the argument is passed directly to pkg and the shell does not expand it.
Both the contents and search subcommands query the content of packages. The pkg contents command displays actions and attributes of packages. The pkg search command lists the packages that match the query. See also Comparing the pkg search and pkg contents Commands.
The following example shows the default behavior of the pkg contents command: Display the value of the path attribute for each file system object that can be installed in this image.
$ pkg contents amp 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. $ pkg contents zip PATH usr/bin/zip usr/bin/zipcloak usr/bin/zipnote usr/bin/zipsplit usr/share/man/man1/zip.1 usr/share/man/man1/zipcloak.1 usr/share/man/man1/zipnote.1 usr/share/man/man1/zipsplit.1
The pkg contents command displays only content that can be installed in this image. If you view the package manifest (use the -m option), you see that the zip package has 12 file actions. The four files that are not shown in this output are files that cannot be installed in this image. This image is an x86 architecture. The files that are not shown are the four /usr/bin files for the SPARC architecture. See Controlling Installation of Optional Components for information about variants and facets.
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(5) 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.
The -a option specifies which attribute values of the action to select. See the pkg(5) 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 1 Displaying Attributes of Files Installed by a PackageThis 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-12-1-preinstall package does not deliver any files, links, or directories directly.
$ pkg contents -r oracle-rdbms-server-12-1-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-12-1-preinstall $ pkg contents -ro action.name oracle-rdbms-server-12-1-preinstall $ pkg contents -ro action.raw oracle-rdbms-server-12-1-preinstallExample 2 Specifying an Action Type
The following command displays the dependency type and package name of each dependency in the oracle-rdbms-server-12-1-preinstall package:
$ pkg contents -rt depend -o type,fmri oracle-rdbms-server-12-1-preinstall TYPE FMRI 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/makeExample 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*' -o type,fmri oracle-rdbms-server-12-1-preinstall TYPE FMRI group x11/library/libxi group x11/library/libxtst
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-12-1-preinstall NAME VALUE pkg.summary Prerequisite package for Oracle Database 12.1 pkg.description Provides the set of Oracle Solaris packages required for installation and operation of Oracle Database 12.Example 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-34 package. See Specifying a Default Application Implementation for information about mediations of multiple versions.
$ pkg contents -a mediator=python -o path,target python-34 PATH TARGET usr/bin/2to3 2to3-3.4 usr/bin/idle idle3.4 usr/bin/pydoc pydoc3.4 usr/bin/python python3.4 usr/bin/python-config python3.4-config usr/bin/pyvenv pyvenv-3.4 usr/lib/amd64/pkgconfig/python3.pc python-3.4.pc usr/lib/pkgconfig/python3.pc python-3.4.pc usr/share/man/man1/python3.1 python3.4.1Example 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(5) 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, both Python 2.6.8 and Python 2.7.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.6 runtime/python-26 usr/bin/python python2.7 runtime/python-27
Oracle Solaris provides several system installation group packages. 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-minimal-server group package installs the minimal supported set of packages required to run Oracle Solaris.
You can use the following command to display the set of packages that is included in the specified group package.
$ pkg contents -ro type,fmri -t depend solaris-minimal-server TYPE FMRI group network/ping group service/network/ssh-common group shell/tcsh group shell/zsh group system/network require developer/debug/mdb require editor/vim/vim-core require group/system/solaris-core-platform require package/pkg require release/name require release/notices require shell/bash require shell/ksh93 require system/core-os require system/library/platform
The -t option matches depend actions in the package. The -o option displays the values of the type and fmri attributes of the depend action. Use pkg.shortfmri to see the version as well as the name of each package. Recall that group packages do not specify file system content; group packages specify other packages that are part of the group. See Group Packages for more information about group packages.
To also show the summary description of each package, use the pkg list -s command. The -o fmri option of the pkg contents command limits the output to what is shown in the second column in the previous example.
$ pkg list -Has `pkg contents -Hro fmri -t depend solaris-minimal-server` developer/debug/mdb Modular Debugger (MDB) editor/vim/vim-core Vi IMproved (core executables) group/system/solaris-core-platform Oracle Solaris Core Platform network/ping Ping command package/pkg Image Packaging System release/name Solaris Naming Enabler release/notices Oracle Solaris notices service/network/ssh-common Secure Shell (SSH) service and configuration files shell/bash GNU Bourne-Again shell (bash) shell/ksh93 Ksh93 - The AT&T Korn Shell shell/tcsh Tenex C-shell (tcsh) shell/zsh Z Shell (zsh) system/core-os Core Solaris system/library/platform Core Architecture, (Kvm) system/network Core Network Infrastructure
The following example displays all packages that require you to accept the package license:
$ pkg contents -rt license -a must-accept=true -o license,pkg.name '*' LICENSE PKG.NAME BCL developer/java/jdk-7 BCL runtime/java/jre-7 LICENSE developer/java/jdk-6 LICENSE library/java/java-demo-6 LICENSE runtime/java/jre-6 lic_OTN consolidation/osnet/osnet-incorporation lic_OTN install-image/solaris-auto-install
You might need to specify the --accept option to install or update these packages.
Use a command such as the following example to display the license text, as described in Displaying Package Licenses. You can list multiple FMRIs.
$ pkg info -r --license runtime/java/jre-7 osnet-incorporation