Solaris 11 pkg commands advance usage

Some questions came into my mind; hope in your as well, regarding the package uninstallation and installation, that which packages and files will get affected due to actions. Kindly find the below commands to address those question.

Some of the outputs are truncated to keep the article precise.

To list all the packages present in group package compress/bzip2.

root@Node1:~# pkg contents -Hro fmri -t depend -a type=group solaris-small-server compress/bzip2



If we want to see the summary of installed package from particular group, as well, then we can add spice using below option. In this case package is installed hence IFO showing the i option.

root@Node1:~# pkg list `pkg contents -Hro fmri -t depend -a type=group solaris-small-server compress/bzip2`

NAME (PUBLISHER)                                  VERSION                    IFO

compress/bzip2 (solaris)                          1.0.6-     i–

compress/gzip (solaris)                           1.4-       i–

compress/p7zip (solaris)                          9.20.1-    i–

compress/unzip (solaris)                          6.0-       i—

In similar way we can also check for the info regarding packages.

To see which files are going to be added during the installation of package.

root@Node1:~# pkg contents -r -t file -o owner,group,pkg.size,path zip


root  bin   228600 usr/bin/zip

root  bin     107944 usr/bin/zipcloak

root  bin     101856 usr/bin/zipnote

root  bin     106252 usr/bin/zipsplit

root  bin      86036 usr/share/man/man1/zip.1

root  bin       2548 usr/share/man/man1/zipcloak.1

root  bin       2239 usr/share/man/man1/zipnote.1

root  bin       1680 usr/share/man/man1/zipsplit.1

To see the information that how much space is required to install the package.

root@Node1:~# pkg info -r zip

          Name: compress/zip

       Summary: Info-Zip (zip)

   Description: The Info-Zip (zip) compression utility

      Category: Applications/System Utilities

         State: Installed

     Publisher: solaris

       Version: 3.0

Build Release: 5.11


Packaging Date: September  4, 2012 05:06:11 PM

          Size: 631.01 kB

          FMRI: pkg://solaris/compress/zip@3.0,5.11-

To show which package is providing the particular file or in this case I can say library.

root@Node1:~# pkg search -lo path,

PATH              PKG.NAME

lib/ system/kernel/power

Suppose I am planning to uninstall one package I want to know which packages on my system depend on the package which I am going to uninstall.

root@Node1:~# pkg search -lo require:system/kernel/power




Another way to do the same thing

root@Node1:~# pkg search -l -o ‘depend:require:library/libxml2’








To see which packages are required to install the package.

root@Node1:~# pkg contents -r -o fmri,type -t depend php-52

FMRI                                                          TYPE

pkg:/compress/bzip2@1.0.6-                    require

pkg:/image/library/libjpeg@6.0.2-              require

pkg:/image/library/libpng@1.4.11-             require

pkg:/library/libtool/libltdl@2.4.2-           require

pkg:/library/libxml2@2.7.6-                   require

pkg:/library/libxslt@1.1.26-                  require

Another way to look the same thing, but this is more useful. In the quotes we can add other options to filter out the things, in the third place we can add the keywords like require,optional,conditional to filter out the packages according to dependency.

root@Node1:~# pkg search -o search.match,search.match_type ‘web/php-52@:depend::’

SEARCH.MATCH                                        SEARCH.MATCH_TYPE

pkg:/compress/bzip2@1.0.6-          require

pkg:/image/library/libjpeg@6.0.2-    require

pkg:/image/library/libpng@1.4.11-   require

pkg:/library/libtool/libltdl@2.4.2- require

Example to add optional parameter to show the optional packages required to install the package.

root@Node1:~# pkg search -o search.match,search.match_type ‘web/php-52@:depend:optional:’


pkg:/web/php-52/documentation optional

I left to you guys to dig further on another parameters of pkg search command.

Thanks for reading !!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s