Useful Solaris pkg commands

Finding out what package claims responsibility for a particular file

    root@monitor:/opt/csw/libexec/hobbit/server> pkgchk -l -p /opt/csw/apache2/sbin/apachectl
    Pathname: /opt/csw/apache2/sbin/apachectl
    Type: regular file
    Expected mode: 0755
    Expected owner: root
    Expected group: bin
    Expected file size (bytes): 3425
    Expected sum(1) of contents: 22037
    Expected last modification: Oct 23 01:42:17 PM 2007
    Referenced by the following packages:
            CSWapache2c
    Current status: installed

To find out which package a file is in

grep <filename> /<span class="code-keyword">var</span>/sadm/install/contents

To find out what files are in a package

grep <<span class="code-keyword">package</span> name> /<span class="code-keyword">var</span>/sadm/install/contents

Displaying what files is in a package

# pkgchk -l -P RICHPse | less
Pathname: /opt/RICHPse
Type: directory
Expected mode: 0755
Expected owner: root
Expected group: bin
Referenced by the following packages:
        RICHPse
Current status: installed

Pathname: /opt/RICHPse/bin
Type: directory
Expected mode: 0755
Expected owner: root
Expected group: bin
Referenced by the following packages:
        RICHPse
Current status: installed

Pathname: /opt/RICHPse/bin/pw_example.sh
Type: regular file
Expected mode: 0755
Expected owner: root
Expected group: bin
Expected file size (bytes): 274
Expected sum(1) of contents: 22134
Expected last modification: Aug 05 06:26:26 2008
Referenced by the following packages:
        RICHPse

Displaying information about pkg files in a directory

<span class="code-keyword">for</span> i in `ls -1 | grep pkg`
<span class="code-keyword">do</span>
pkginfo -l -d $i | egrep <span class="code-quote">"PKGINST|NAME|VERSION"</span>
done
















pkginfo -R `pwd` -l | egrep <span class="code-quote">"PKGINST|NAME|VERSION"</span>











Current status: installed
Share