<!-- 
The contents of this Documentation are subject to the Public Documentation
License Version 1.01 (the "License"); you may only use this Documentation if
you comply with the terms of this License. A copy of the License is
available at http://www.opensolaris.org/os/community/documentation/license.
-->

<chapter id="cmd_ref"><title><citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> Command Reference</title><highlights><para>The <citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> command enables users to create images, and install, search,
and manage packages on their system.</para>
</highlights><sect1><title><command>pkg(1)</command> Command Reference</title><para><citerefentry><refentrytitle>pkg</refentrytitle><manvolnum>1</manvolnum></citerefentry> supports two options directly:</para><itemizedlist><listitem><para><option>R</option> &ndash; Perform the packaging operations
on the image rooted at <replaceable>dir</replaceable>, rather than the image
discovered automatically. All the <command>pkg</command> commands accept <command><option>R</option> <replaceable>dir</replaceable></command> as an option.</para>
</listitem><listitem><para><option>-help</option> or <option>?</option> &ndash; List
the subcommands and options supported by <command>pkg(1)</command>.</para>
</listitem>
</itemizedlist><para>For the OpenSolaris 2009.06 release, the <command>pkg</command> command
has the following subcommands and options.</para><table frame="topbot" pgwide="1" id="pkgtbl"><title><command>pkg(1)</command> Commands</title><tgroup cols="3" colsep="0" rowsep="0"><colspec colwidth="49.30*"/><colspec colwidth="92.11*"/><colspec colname="colspec0" colwidth="37.45*"/><thead><row rowsep="1"><entry><para>Subcommands</para>
</entry><entry><para>Description</para>
</entry><entry><para>Privileges Required to Run Command</para>
</entry>
</row>
</thead><tbody><row><entry><para><command>pkg image-create</command></para>
</entry><entry><para>Creates an image suitable for package operations at the directory specified
by <replaceable>dir</replaceable>.</para><para>Syntax : <command>pkg image-create [-fFPUz] [--force] [--full | --partial
| --user] [--zone] [-k <replaceable>ssl_key]</replaceable> [-c ssl_cert] [--no-refresh]
(-p | --publisher) name=<replaceable>origin_uri</replaceable> <replaceable>dir</replaceable></command></para><itemizedlist><listitem override="none"><para><option>F</option>&ndash; Creates a full image.</para>
</listitem><listitem override="none"><para><option>f</option>&ndash; Forces the command
to create an image over an existing image.</para><caution><para>Use this option with care. See <olink type="auto-generated" targetptr="giifi" remap="internal"></olink>.</para>
</caution>
</listitem><listitem override="none"><para><option>P</option> &ndash; Creates a partial
image.</para>
</listitem><listitem override="none"><para><option>U</option> &ndash; Creates a user
image (default).</para>
</listitem><listitem override="none"><para><option>z</option> &ndash; Runs the image
in a non-global zone context.</para>
</listitem><listitem override="none"><para><option>p</option>&ndash; Specifies a preferred
publisher.</para><note><para>This option <emphasis role="strong">must</emphasis> be specified.</para>
</note>
</listitem><listitem override="none"><para><option>c</option> &ndash; Specifies the client
key (for publishers using client SSL authentication).</para>
</listitem><listitem override="none"><para><option>k</option> &ndash; Specifies certificate
(for publishers using client SSL authentication).</para>
</listitem><listitem override="none"><para><option>-no-refresh</option> &ndash; Does
not attempt to contact the image's publisher to retrieve its catalog.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg image-update</command></para>
</entry><entry><para>Updates all installed packages in the current image to the latest available
version.</para><para>Syntax: <command>pkg image-update [-fnvq] [--be-name <replaceable>name</replaceable> [--no-refresh]
[--no-index]</command></para><itemizedlist><listitem override="none"><para><literal>-f</literal> - Skips safety checks.</para>
</listitem><listitem override="none"><para><literal>-n</literal> - Executes the requested
operation but make no persistent changes to the image.</para>
</listitem><listitem override="none"><para><literal>-v</literal> - Issues verbose progress
messages during the requested operation.</para>
</listitem><listitem override="none"><para><literal>-q</literal> - No message is shown
during command execution.</para>
</listitem><listitem override="none"><para><literal>---be-name</literal> - Renames the
newly created boot environment to the name specified by <replaceable>name</replaceable>.
This option is valid only if a new boot environment is created during image-update.
See also beadm(1).</para>
</listitem><listitem override="none"><para><literal>--no-refresh</literal> - Does not
attempt to contact the image's authorities to retrieve their catalogs.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg refresh</command></para>
</entry><entry><para>Retrieves updated catalogs for each publisher registered within the
image.</para><para>Syntax: <command>pkg refresh [-full] <replaceable>[publisher..]</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-full</literal> - Retrieves full
catalog.</para>
</listitem><listitem><para>When no publisher is specified, the command retrieves updates
for each publisher registered within the image.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg install</command></para>
</entry><entry><para>Installs a package.</para><para>Syntax: <literal>pkg install [-nvq] [--no-refresh] [--no-index] <replaceable>pkg_fmri</replaceable></literal></para><itemizedlist><listitem override="none"><para><literal>-n</literal> - Executes the requested
operation but makes no persistent changes to the image.</para>
</listitem><listitem override="none"><para><literal>-v</literal> - Issues verbose progress
messages during the requested operation.</para>
</listitem><listitem override="none"><para><literal>--no-refresh</literal> - Does not
attempt to contact the image's authorities to retrieve their catalogs.</para>
</listitem><listitem override="none"><para><literal>--no-index</literal> - Does not update
the search indexes after the operation has completed successfully.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg uninstall</command></para>
</entry><entry><para>Uninstalls a package.</para><para>Syntax: <command>pkg uninstall [-nrvq] <replaceable>pkg_fmri</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-n</literal> - Executes the requested
operation but makes no persistent changes to the  image.</para>
</listitem><listitem override="none"><para><literal>-v</literal> - Issues verbose progress
messages during the requested operation.</para>
</listitem><listitem override="none"><para><literal>-r</literal> - Recursively uninstall
any packages that are dependent on the initial package.</para>
</listitem><listitem override="none"><para><literal>--no-refresh</literal> - Does not
attempt to contact the image's authorities to retrieve their catalogs.</para>
</listitem><listitem override="none"><para><literal>--no-index</literal> - Does not update
the search indexes after the operation has completed successfully.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg info</command></para>
</entry><entry><para>Displays information about a package.</para><para>Syntax : <command>pkg info [-lr] [--license] <replaceable>pkg_fmri</replaceable></command></para><itemizedlist><listitem><para><literal>-l</literal> &ndash; Displays the data available
from locally installed packages. This is the default option.</para>
</listitem><listitem><para><literal>-r</literal> &ndash; Shows the latest available package
on the server. A package FMRI must be specified with this option.</para>
</listitem><listitem><para><literal>--license</literal> &ndash; Displays license and
copyright information for a package.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg contents</command></para>
</entry><entry><para>Displays the contents (action attributes) of packages in the current
image.</para><para>Syntax : <command>pkg contents [-Hmr] [-o <replaceable>attribute</replaceable>]
[ -s <replaceable>sort_key</replaceable>] [-t <replaceable>action_type</replaceable>] <replaceable>pkg_fmri</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-m</literal> - Shows the complete
contents of the action as represented in the package manifest.</para>
</listitem><listitem override="none"><para><literal>-o</literal> - Specifies the attributes
that you are searching for. Multiple attributes can be specified with a single <option>o</option> option by separating the attributes with commas. <emphasis role="strong">If this option is not specified, only the path attribute is
displayed.</emphasis></para>
</listitem><listitem override="none"><para><literal>-r</literal> - Retrieves the contents
of a package from the server. This option is used in cases where the package
is not already installed. A package FMRI must be specified when using this
option.</para>
</listitem><listitem override="none"><para><literal>-s</literal> - Sorts the display
based on the specified attribute.</para>
</listitem><listitem override="none"><para><literal>-t</literal> - Displays information
pertaining only to the specified action.</para>
</listitem><listitem override="none"><para><literal>-H</literal> - Does not display any
headers.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg search</command></para>
</entry><entry><para>Searches for <replaceable>token</replaceable>, and displays the FMRIs
in which <replaceable>token</replaceable> was found.</para><para>Syntax: <command>pkg search [-alprI] [-s server] <replaceable>query</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-a</literal> - Display information
about matching actions along with the search results.</para>
</listitem><listitem override="none"><para><literal>-l</literal> - Searches the installed
packages on the image. </para>
</listitem><listitem override="none"><para><literal>-p</literal> - Perform the search
and display the packages which contain atleast one action that matched <replaceable>query</replaceable>.</para>
</listitem><listitem override="none"><para><literal>-r</literal> - Searches the repository
corresponding to the image's publishers. This is the default option. This
option can be combined with the <option>l</option> option so that both local
and remote searches are performed.</para>
</listitem><listitem override="none"><para><literal>-s</literal> - Searches for packages
in the specified server, a <citerefentry><refentrytitle>pkg(5) </refentrytitle></citerefentry> repository. Multiple servers can be specified. This option
can be combined with the <option>l</option> option.</para>
</listitem><listitem override="none"><para><literal>-I</literal> - Search for packages
in a case sensitive manner.</para><note><para>The <option>I</option> option can only be used with the default
option, <option>l</option> at this time.</para>
</note><note><para>Boolean search using <literal>AND</literal> and <literal>OR</literal> is
supported. For more information, see the <ulink url="http://pkg.opensolaris.org/sc/src/man/pkg.1.txt" type="text">pkg(1)</ulink> man
page.</para>
</note>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg list</command></para>
</entry><entry><para>Displays most recent version information about the state of packages
in the current image.</para><para>Syntax: <command>pkg list [-aHsuvf] [--no-refresh] <replaceable>pkg_fmri</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-a</literal> - Display information
on <emphasis role="strong">all</emphasis> known packages, whether they are
installed or not installed.</para>
</listitem><listitem override="none"><para><literal>-H</literal> - Do not display any
headers.</para>
</listitem><listitem override="none"><para><literal>-s</literal> - Display only package
name and description of the package.</para>
</listitem><listitem override="none"><para><literal>-u</literal> - Show information only
about packages which have newer versions available.</para>
</listitem><listitem override="none"><para><literal>-v</literal> - Show detailed package
FMRIs.</para>
</listitem><listitem override="none"><para><literal>-f</literal> - List all known versions
of a package.</para>
</listitem><listitem override="none"><para><literal>--no-refresh</literal> - Do not attempt
to contact the repositories for the image's publishers to retrieve publisher
metadata.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg verify</command></para>
</entry><entry><para>Validate the installation of packages in the current image.</para><para>Syntax: <command>pkg verify <option>[Hqv]</option> <replaceable>pkg_fmri</replaceable></command></para><itemizedlist><listitem override="none"><para><literal>-v</literal> - Display verbose information.</para>
</listitem><listitem override="none"><para><literal>-q</literal> - Do not report anything
but return failure if there are any verification problems.</para>
</listitem><listitem override="none"><para><literal>-H</literal> - Remove headers from
the listing.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg fix</command></para>
</entry><entry><para>Fixes any errors reported by <command>pkg verify</command></para><para>Syntax : <command>pkg fix <replaceable>pkg_fmri</replaceable></command></para>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg set-property <replaceable>propname</replaceable> <replaceable>propvalue</replaceable></command></para>
</entry><entry><para>Updates an existing image property or add a new image property.</para><note><para>The preferred publisher property cannot be changed using this
subcommand. Use <command>pkg set-publisher</command> to change the preferred
publisher.</para>
</note>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg unset-property <replaceable>propname</replaceable> <replaceable>propvalue</replaceable></command></para>
</entry><entry><para>Removes an existing image property or add a new image property.</para><note><para>The preferred publisher property cannot be changed using this
subcommand. Use <command>pkg set-publisher</command> to change the preferred
publisher.</para>
</note>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg property <replaceable>[propname..]</replaceable></command></para>
</entry><entry><para>Displays image property information.</para><itemizedlist><listitem override="none"><para><literal>No argument</literal> &ndash; Display
name and values for all image properties.</para>
</listitem><listitem override="none"><para><literal>-H</literal> &ndash; Remove headers
from the listing.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg set-publisher</command></para>
</entry><entry><para>Updates an existing publisher or adds an additional package publisher.</para><para>Syntax: <command>pkg set-publisher [-Ped] [-k ssl_key] [-c ssl_cert]
[-O origin_url] [-m mirror_to_add] [-M mirror_to_remove] [--enable] [--disable]
[--no-refresh] [--reset-uuid] publisher</command></para><itemizedlist><listitem override="none"><para><literal>-P</literal> - Sets the specified
publisher as the preferred publisher.</para>
</listitem><listitem override="none"><para><literal>-c</literal> - Specifies client SSL
certificate.</para>
</listitem><listitem override="none"><para><literal>-k</literal> - Specifies client key.</para>
</listitem><listitem override="none"><para><literal>-O</literal> - Sets the URL prefix
for the origin packaging repository for the publisher.</para>
</listitem><listitem override="none"><para><literal>-m</literal> - Adds the URI as a
mirror for the given publisher.</para>
</listitem><listitem override="none"><para><literal>-M</literal> - Removes the URI as
a mirror for the given publisher.</para>
</listitem><listitem override="none"><para><literal>-e</literal> - Enables the given
publisher.</para>
</listitem><listitem override="none"><para><literal>-d</literal> - Disables the given
publisher.</para><note><para>A disabled publisher is not used when the package list is being
populated or in certain package operations. However the properties for a disabled
publisher can still be set and viewed.</para>
</note><caution><para>If only one publisher exists, it cannot be disabled.</para>
</caution>
</listitem><listitem override="none"><para><literal>--no-refresh</literal> - Do not attempt
to contact the specified publisher to retrieve the metadata.</para>
</listitem><listitem override="none"><para><literal>---reset-uuid</literal> - Choose
a new, unique identifier to identify this image to the publisher.</para>
</listitem>
</itemizedlist>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg unset-publisher</command></para>
</entry><entry><para>Removes the configuration associated with the given publisher.</para><para>Syntax: <command>pkg unset-publisher <replaceable>publisher</replaceable></command></para>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg publisher</command></para>
</entry><entry><para>Displays publisher information. If a publisher is specified,
configuration values associated with the publisher is displayed. </para><para>Syntax: <command>pkg publisher [-HPa] <replaceable>publisher</replaceable></command></para><itemizedlist><listitem override="none"><para>No argument - Display the list of all configured
publishers, their origin URLs , and their mirrors.</para>
</listitem><listitem override="none"><para><literal>-H</literal>- Remove headers from
the listing.</para>
</listitem><listitem override="none"><para><literal>-P</literal>- Display only preferred
publisher information.</para>
</listitem><listitem override="none"><para><literal>-a</literal>- Display all publishers
including those that have been disabled.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg history</command></para>
</entry><entry><para>Displays the history of operations executed in the image.</para><para>Syntax : <command>pkg history [-Hl]</command></para><itemizedlist><listitem override="none"><para><literal>-H</literal> &ndash; Remove headers
from the listing.</para>
</listitem><listitem override="none"><para><literal>-l</literal> &ndash; Display detailed
history information which includes the outcome of the command, when the command
completed execution, version and name of the client used, identity of the
user who performed the operation, and any errors encountered while executing
the command.</para>
</listitem>
</itemizedlist>
</entry><entry><para>No</para>
</entry>
</row><row><entry><para><command>pkg purge-history</command></para>
</entry><entry><para>Deletes all existing history information.</para>
</entry><entry><para>Yes</para>
</entry>
</row><row><entry><para><command>pkg help</command></para>
</entry><entry><para>Views a list of all available commands and their associated options.</para>
</entry><entry><para>No</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
</sect1>
</chapter>