11

Is there a way to list the installed files with pkg for a certain package?

2 Answers 2

12

pkg info -l PACKAGENAME or pkg info --list-files PACKAGENAME. You can find the -l option in man pkg-info. (And you can in turn find the pkg info subcommand and a pointer to its aformentioned manual page in man pkg.)

1
  • Beware the order of the arguments: pkg -l info PACKAGENAME will not produce desired output Jul 30, 2022 at 14:40
2

Although it's not documented in the man page for pkg, pkg list PACKAGENAME is the most concise way, and easiest to remember, at least for me.

One difference between this method and that proposed by @uzsolt is that pkg info -l produces output that is perhaps more suited for "human consumption," with minor touches of formatting:

$ pkg info -l mod_php73
mod_php73-7.3.7:
        /usr/local/libexec/apache24/libphp7.so
        /usr/local/share/licenses/mod_php73-7.3.7/LICENSE
        /usr/local/share/licenses/mod_php73-7.3.7/PHP301
        /usr/local/share/licenses/mod_php73-7.3.7/catalog.mk

pkg list OTOH produces more austere output, strictly a raw list of filenames, suitable for counting, iteration or other forms of "machine consumption":

$ pkg list mod_php73
/usr/local/libexec/apache24/libphp7.so
/usr/local/share/licenses/mod_php73-7.3.7/LICENSE
/usr/local/share/licenses/mod_php73-7.3.7/PHP301
/usr/local/share/licenses/mod_php73-7.3.7/catalog.mk
4
  • list is only an alias, check here: github.com/freebsd/pkg/blob/master/src/pkg.conf.sample#L71 If you use info -ql (note the q) you can receive same output as list.
    – uzsolt
    Nov 28, 2021 at 12:21
  • @uzsolt Thanks for that information. That's partly why I qualified my answer with 'most concise' and 'easiest to remember.'
    – Jim L.
    Nov 29, 2021 at 6:47
  • I didn't notice this alias - so your answer was useful. I wrote my comment because of "not documented in the man page", so I think it's understandable now, why "not documented" :)
    – uzsolt
    Dec 1, 2021 at 5:20
  • @uzsolt IMO, it's worth documenting, though. Given the paradigm of a "package," what more intuitive way is there to query the contents of a given package than to look at the "packing list," i.e. the pkg list? Hence for me, at least, easiest to remember. Cheers!
    – Jim L.
    Dec 1, 2021 at 6:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .