* Paul B. Henson (henson at acm.org) wrote:
> 
> Is there any easy way to determine on an installed system which package
> owns a particular file? Reviewing the documentation, I see there is a way
> to list out all files owned by a particular package, but I didn't see a way
> to query the other side.
> 
> I suppose you could dump out the files owned for each package individually
> and try to find the file in question, but that seems inefficient.

If you're talking about OpenSolaris 2008.05, then:

pkg search <file>

Is what you're after.

glagasse at glorfindel:~ % pkg search bash
INDEX      ACTION    VALUE                     PACKAGE
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.86

This searches the *installed* packages.  If it returns no output then
the file isn't installed.  In that case, you want the -r parameter to
pkg search:

glagasse at glorfindel:~ % pkg search -r bash
INDEX      ACTION    VALUE                     PACKAGE
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.86
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.86
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.75
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.75
basename   file      usr/bin/bash              pkg:/SUNWbash at 3.2.25-0.79

This queries the remote repository.

Cheers,

Glenn

Reply via email to