Solved How to display "top level" packages that are installed

I have been reading and reading about this, but either I am not seeing the answer or it isn't documented where I have looked ...
Is there a reasonably simple way to display the top level packages currently installed on a system? When I say top level packages, I refer to the package name used in the pkg command that installed the package, so for instance a meta package name without having to see the many dependencies possibly pulled in? This should yield something like xfce4 as opposed to the pages of packages supporting it that were pulled in automatically? I seek to find a way to reconstruct an installation after the fact, and so need the names to be issued to "pkg install" to accomplish a reconstruction.

Did I miss something, or would this require a huge effort to accomplish ... even a fairly involved shell script would be fine with me. I just don't want to spend a lot of time and effort guiding a process by hand to do this.

Thanks for any guidance I can get on this.

QG
 
Having just tried it out, I can vouch for the fact first hand that "pkg prime-list" works a treat ... But I re-iterate what skunk said is so -- I did not find that in the man page. Might a man page update be in order here?
 
The man page info of pkg has grown considerably over time, that creates a problem of a man page that is (too) long. In an attempt to alleviate that problem, the one-man-page of pkg(8) info has been split into several separate ones, for example pkg-install(8) and pkg-info(8), in addition to pkg(8) (and indirectly also to pkg(7) ).
In order to assist the user in this new scheme an additional "help function" has been introduced:
Code:
$ pkg help prime-list
`prime-list` is an alias to `query -e '%a = 0' '%n'`
You now have two options to view the concrete man page:
pkg help alias
or
man pkg-alias
This will lead you to pkg alias that lists all “pkg-aliases”.

Reference links to all those split-off "sub-man-pages" are, as a rule, also mentioned in the "SEE ALSO" section; thus in pkg(8).
 
One of these days I will get the hang of how all this works, and at that point I will probably scare myself ;).

Thanks be to mer for a very effective answer, and to Charlie_ and Erichans for some further explanation. I am now quite satisfied and will go forward from here.

QG
 
  • Like
Reactions: mer
The man page info of pkg has grown considerably over time, that creates a problem of a man page that is (too) long. In an attempt to alleviate that problem the one-man-page of pkg has been split into several separate ones
While I can understand the reasoning for that, I still found it much easier to have just one big manpage (e.g. for zfs) and simply search in it via '/<keyword>' and maybe a few taps on 'n'.
Now one has to look at the "SEE ALSO" section of the main manpage (which can be quite a long list) and guess or try in which of the sometimes dozens of scattered manpages the thing might be one is looking for - and still do a search in that/those manpage(s) to find it...

regarding the initial question:
there is also pkg prime-origins which is helpful if you also need the section where those ports are in the ports tree (or e.g. to generate a list of ports for poudriere to build)
 
Well, ehmm, you also have: pkg help which gives a nice one-line-per-command overview.

That said, I can understand your view, UX preferences differ and I doubt there is one good solution that satisfies all. I still have problems on and off to find everything I am looking for in for example sh(1); finding a correct "mostly-unique" anchor word takes experience. The days of a one man page for all ZFS have come and gone. Unfortunately, zfs has not quite (yet) fully implemented the solution taken by pkg. Poudriere has been split into sub-man-pages too, but has also not "fully" followed the pkg way, a bit more in that direction though.
 
I seek to find a way to reconstruct an installation after the fact, and so need the names to be issued to "pkg install" to accomplish a reconstruction.

Did I miss something, or would this require a huge effort to accomplish ... even a fairly involved shell script would be fine with me. I just don't want to spend a lot of time and effort guiding a process by hand to do this.

Thanks for any guidance I can get on this.

QG
I do it that way.

pkg prime-list > pkglist

pkglist will be just a simple text file with your packages listed inside.

To reconstruct your packages on a new system you can do: pkg install `cat pkglist`
 
Back
Top