View Full Version : [Solved] list of installed ports?
wonslung
June 15th, 2009, 23:42
is there a way to list all the installed ports on a system or in a jail?
vivek
June 15th, 2009, 23:57
pkg_info
OR
pkg_info | less
pkg_info | grep -i php
ale
June 16th, 2009, 07:12
pkg_info | grep -i phpDon't pipe into grep, just use -xpkg_info -Ix php
SirDice
June 16th, 2009, 08:09
Another nice one to use is pkg_version -v.
ale
June 16th, 2009, 19:24
Another nice one to use is pkg_version -v.portversion -v (from ports-mgmt/portupgrade) is a lot faster (about 6s vs. 70s here).
SirDice
June 16th, 2009, 19:33
portversion -v (from ports-mgmt/portupgrade) is a lot faster (about 6s vs. 70s here).
It does require an additional port. Pkg_version and pkg_info are part of the base OS. I also doubt the speed. It takes a while for portversion to collect data before it produces output. Pkg_version immediately starts producing output. Which probably accounts for the apparent difference in speed.
ale
June 16th, 2009, 19:57
It does require an additional port. Pkg_version and pkg_info are part of the base OS.Obviously, but if the OP is using portupgrade for upgrading his ports, portversion is free.
I also doubt the speed. It takes a while for portversion to collect data before it produces output. Pkg_version immediately starts producing output. Which probably accounts for the apparent difference in speed.Apparent?$ time `pkg_version -v > /dev/null`
real 1m15.667s
user 0m41.320s
sys 0m12.968s
$ time `portversion -v > /dev/null`
real 0m7.332s
user 0m5.066s
sys 0m1.199s(with 749 installed ports)
ale
June 16th, 2009, 20:01
BTW, for a faster plain list (without version check) ls -1d /var/db/pkg/*
phoenix
June 16th, 2009, 21:41
Don't forget that portupgrade (and hence portversion) require two separate databases be installed and kept up-to-date (portsdb and pkgdb). All the portupgrade tools use these databases to pull their info, they don't use the /usr/ports/INDEX* or /var/db/pkg/* directly.
While it's not common, it is possible for the separate databases used by the portupgrade tools to become out-of-sync with the actual data in /var/db/pkg/* and/or /usr/ports/INDEX*, in which case you get incorrect results when using portversion.
Hence why, even though it may be slower, it's generally safer/more accurate to use pkg_version. (Plus, it's always nice to use the built-in tools.) :)
Just something to keep in mind.
jb_fvwm2
June 17th, 2009, 01:47
ls -lac /var/db/pkg
-l -a -c == "lack", for that reason, I always have used it,
even aliasing it to a shorter version (one word)
............
I wouldn't have posted it here, but its output seems
easier to read (the names are on the right of the screen).
(its usage here, maybe not in other instances).
......................
Also weekly it may be wise to
ls -lac /var/db/pkg | tee -a vardMODA.YR (month day year)
and copy it elsewhere. (You may be at another
computer wondering what ports you have installed and
have a backup copy available).
wonslung
June 17th, 2009, 02:18
wow, thanks guys.
js
November 20th, 2009, 13:21
Thanks for the info. Been meaning to have a useful easy to refer to list of what ports are installed that can be emailed somewhere else regularly, and this has done the trick perfectly.
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.