Solaris pkg command

Here's a quick "cheat sheet" for the most useful pkg commands.
pkg publisher           - show which publisherS it knows about
pkg install xyz         - install xyz
pkg list    xyz         - search *installed* package names, for xyz. wildcardable.
pkg search /x/y/z       - search all packages, for file /x/y/z
pkg search pkg.fmri:xyz - search all packages, for package xyz
pkg search xyz          - search packages for xyz, in pkgname,file,description, ...
And some special-case uses, that are very useful:

Querying available packages from repository

Some pkg commands support a "-r" option, to say "search the remote catalogs, rather than what is installed locally."
In that spirit, you should be able to do "pkg list -r find-some-pkg-here". But you can't.

It turns out that you CAN do "pkg list -a some-pkg-here", which sort of gives you that kind of information, if you dont have it installed already. However, if you do have it installed locally, it will show you the local version string instead.

If you explicitly want to look at ONLY the remost catalog, you can use the "pkgrepo" command.

Unfortunately, the tool is not user friendly, in that you must specify a particular repo on the command line, each and every time.
That being said, you'll want to know the following magic string:

pkgrepo list -s http://pkg.oracle.com/solaris/release 'group/system/*'
This will tell you all the nice clean preconfigured system "groups" available on the remote server. These particular subgroups, or "collections", are sort of equivalent to the old metaClusters on a Solaris distribution cd.
The ones currently visible are:
group/system/solaris-auto-install  (the default small system config)
group/system/solaris-desktop
group/system/solaris-large-server
group/system/solaris-small-server

Another way to get this information, in a little more hacky way, is

pkg info -r '*group*' | grep Name
This method is a bit faster, because it uses the cached version of the remote catalog. pkgrepo on the other hand, talks to the remote server every time. However, this only gives you the Name. If you want to instead know all the details while still keeping one line of output I suggest using
pkg info -r '*group*' | grep FMRI
Unfortnately, the output will be Very Long Lines


This material is copyrighted by Philip Brown
Bolthole Top - Solaris Top - Search Bolthole.com