FreeBSD 10: list packages without descriptions

999 views Asked by At

I need a way to print all packages installed on a FreeBSD 10 OS without the descriptions. Does such a command exist?

I've tried this:

pkg info

which does list all of the packages, but it also lists the descriptions like so:

pkg-1.5.4              Package manager
python26-2.7.9_1       Interpreted object-oriented programming language
....

Is is possible to print this info without the description? this would turn the above into this?

pkg-1.5.4
python26-2.7.9_1
....

Note: I'm on FreeBSD 10, which has replaced the pkg_install, pkg_info, etc. commands with pkg install, pkg info, etc

1

There are 1 answers

0
Hukadan On BEST ANSWER

When you want a specific format, it is better to use the pkg query command (see pkg-query(8)).

In your case, you want to list all the packages with the name and the version separated by '-'. Then the command should be pkg query -a %n-%v where -a list all the installed packages and %n-%v print the ouput with name-version format.

You can have more information on the QUERY FORMAT part of the man page.