Compare installed packages between two FreeBSDs

Hi
I have installed FreeBSD (12.2-RELEASE) on two systems (Say, hosts: FB-1 and FB-2). FB-1 was installed six months ago and contains a lot of packages that were installed from Repo during this time period. However, FB-2 is a fresh install and contains few package installed from Repo. Now I want to compare installed packages between these two OSes, that is which packages are present in FB-1, but are missing from FB-2. One method that comes to my mind is:
Code:
pkg info > FB-1-Packages
pkg info > FB- Packages
diff FB-{1,2}-Packages
I am at work and I cannot access these two FreeBSD systems for next few hours, however, I suspect that this is not the correct way to compare packages. Can you help me in this regard?
Thanks
 
Look at the output from pkg leaf or pkg prime-list and compare those. You could use pkg info but that will also show all automatically installed dependencies, which you shouldn't install by hand (that messes up pkg-autoremove(8)).
 
Use pkg query -e '%a = 0' %n to disregard versions and only consider packages not installed automatically as dependencies.

edit ok, pkg prime-list does exactly the same ;)
 
Not enough coffee. Zirias beat me to it. The query he shows is the same as the prime-list alias.
And of course I should have read SirDice reply closer :)

I like using "pkg prime-list" for this. prime-list is an alias (pkg alias) that resolves to 'query -e '%a = 0' '%n'' (those are single quotes). It basically gives you a list of just package names, like (snipped example):
Code:
drm-kmod
droid-fonts-ttf
emacs
evince-lite
falkon-qtonly
firefox
gimp
git
 
Look at the output from pkg leaf or pkg prime-list and compare those. You could use pkg info but that will also show all automatically installed dependencies, which you shouldn't install by hand (that messes up pkg-autoremove(8)).

Use pkg query -e '%a = 0' %n to disregard versions and only consider packages not installed automatically as dependencies.

edit ok, pkg prime-list does exactly the same ;)

Not enough coffee. Zirias beat me to it. The query he shows is the same as the prime-list alias.
I like using "pkg prime-list" for this. prime-list is an alias (pkg alias) that resolves to 'query -e '%a = 0' '%n'' (those are single quotes). It basically gives you a list of just package names, like (snipped example):
Code:
drm-kmod
droid-fonts-ttf
emacs
evince-lite
falkon-qtonly
firefox
gimp
git
Thanks. I will try it and come back with results in few hours.
 
Yes, pkg prime-list is an alias. The nice thing about that one is that you can create a text file from it and feed that to pkg-install(8) on another machine.
 
Back
Top