The pkg list command shows whether a package is installed in the current image and whether an update is available. With no options or operands, the pkg list command lists all packages that are installed in the current image. 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.
The pkg list command displays one line of information for each matching package, as shown in the following example. The “i” in the I column indicates that these packages are installed in this image.
$ pkg list '*java*8*' NAME (PUBLISHER) VERSION IFO consolidation/java-8/java-8-incorporation 18.104.22.168.11-0 i-- runtime/java/jre-8 22.214.171.124.11 i--
If a publisher name is shown in parentheses after the package name, that publisher is not the first publisher in the publisher search order in this image. Both of the packages shown in this example are published by the publisher that is the first publisher in the search order. See Setting Publisher Search Order and Stickiness.
To list packages that are installed and the newest versions of packages that are not installed but could be installed in this image, use the -a option.
$ pkg list -a '*java*8*' NAME (PUBLISHER) VERSION IFO consolidation/java-8/java-8-incorporation 126.96.36.199.11-0 i-- developer/java/jdk-8 188.8.131.52.11 --- library/java/java-demo-8 184.108.40.206.11 --- runtime/java/jre-8 220.127.116.11.11 i-- web/java-servlet/tomcat-8 8.5.28-18.104.22.168.1.10.0 --- web/java-servlet/tomcat-8/tomcat-admin 8.5.28-22.214.171.124.1.10.0 --- web/java-servlet/tomcat-8/tomcat-examples 8.5.28-126.96.36.199.1.10.0 ---
This output indicates that a developer kit, a demo library, and tomcat packages are available and can be installed in this image.
To list the newest versions of all matching packages, including packages that cannot be installed in this image, use the -n option.
$ pkg list -n '*java*8*' NAME (PUBLISHER) VERSION IFO consolidation/java-8/java-8-incorporation 188.8.131.52.12-0 --- developer/java/jdk-8 184.108.40.206.12 --- library/java/java-demo-8 220.127.116.11.12 --- runtime/java/jre-8 18.104.22.168.12 --- web/java-servlet/tomcat-8 8.5.28-22.214.171.124.1.10.0 --- web/java-servlet/tomcat-8/tomcat-admin 8.5.28-126.96.36.199.1.10.0 --- web/java-servlet/tomcat-8/tomcat-examples 8.5.28-188.8.131.52.1.10.0 ---
The tomcat packages are the same version as the packages listed with the –a option; these tomcat packages could be installed. Other packages on this list are a newer version than the same packages that are listed with the –a option. You know these packages cannot be installed into this image because they are not listed by the –a option. These packages cannot be installed because the version that can be installed is constrained as described in Constraint Packages. To get these packages on your system, you must pkg update the system, which will create a new image.
The newest version of a package could be an obsolete package (shows an “o” in the O column) or a renamed package (shows an “r” in the O column). See Renamed and Obsolete Packages for more information.
The -u option lists all installed matching packages that have newer versions available. The number of packages that have newer versions available might be larger than the number of packages that could be updated in this image, as discussed in Newest Packages. The installed packages shown below have updates available, but those updates cannot be installed into the current image. Packages can be updated only to versions allowed by the constraints imposed on the image by installed package dependencies and publisher configuration.
$ pkg list -u '*java*8*' NAME (PUBLISHER) VERSION IFO consolidation/java-8/java-8-incorporation 184.108.40.206.11-0 i-- untime/java/jre-8 220.127.116.11.11 i--
To list all available versions of all matching packages, including packages that cannot be installed in this image, use the -af option. The -f option cannot be used without the -a option. You might want to specify a portion of the version string to narrow these results. Specifying the special version string @latest shows the same result as the -n option shows.
$ pkg list -af jre-8 NAME (PUBLISHER) VERSION IFO runtime/java/jre-8 18.104.22.168.12 --- runtime/java/jre-8 22.214.171.124.11 i-- runtime/java/jre-8 126.96.36.199.12 --- ...
In the following example, the “o” in the O column indicates that the package is obsolete, and the “r” in the O column indicates that the package has been renamed.
$ pkg list -n jdk storage/storage-nas NAME (PUBLISHER) VERSION IFO developer/java/jdk 188.8.131.529.99 --o storage/storage-nas 0.1-0.173.0.0.0.1.0 --r
Neither obsolete nor renamed packages are installable.
If you try to install an obsolete package, the installation fails with the message that no updates are necessary for this image.
$ pkg install developer/java/jdk No updates necessary for this image.
Even if a package has not been renamed, you might be able to find a similar package that could be installed. From preceding examples, you know that jdk-8 could be installed.
If you try to install a renamed package, the system attempts to install the package to which the renamed package has been renamed.
Use the pkg info command to determine the new name of a renamed package. Use the -r option to query the configured package repositories because the package is not installed. See the “Renamed to” line, as shown in the following example:
$ pkg info -r storage/storage-nas Name: storage/storage-nas State: Not installed (Renamed) Renamed to: consolidation/osnet/osnet-incorporation pkg:/firstname.lastname@example.org,5.11-0.173.0.0.0.0.0 Publisher: solaris Version: 0.1 Branch: 0.173.0.0.0.1.0 Packaging Date: Fri Aug 26 16:26:38 2011 Size: 5.45 kB FMRI: pkg://email@example.com:20110826T162638Z
If you try to install the storage/storage-nas package, the group/feature/storage-nas package will be installed instead if it is not already installed and if it can be installed in this image.
If the “Renamed to” package is already installed, the packaging system reports that no updates are necessary.
An “f” in the F column indicates the package is frozen. If a package is frozen, you can only install or update to packages that match the frozen version. See Locking Packages to a Specified Version for information about freezing packages.
$ pkg list -v entire FMRI IFO pkg://firstname.lastname@example.org:20180702T173343Z i-- $ pkg freeze -c "Prevent update to SRU 1 until ready." email@example.com entire was frozen at 11.4-11.4.0 $ pkg list -v entire FMRI IFO pkg://firstname.lastname@example.org:20180702T173343Z if-