Is there a way to list the installed files with pkg for a certain package?
Asked
Active
Viewed 6,352 times
11
Mateusz Piotrowski
- 4,623
- 5
- 36
- 70
viuser
- 2,564
- 3
- 29
- 57
2 Answers
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.)
-
Beware the order of the arguments: `pkg -l info PACKAGENAME` will not produce desired output – somenxavier Jul 30 '22 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
Jim L.
- 7,188
- 1
- 13
- 25
-
`list` is only an alias, check here: https://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 '21 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 '21 at 06: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 01 '21 at 05: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 01 '21 at 06:02