The pkg_version command is used to produce a report of non-base software packages installed using the pkg_add(1) command.
Each packages version number is checked against one of two sources to see if that package may require updating. If the package contains information about its origin in the
.Fx ports tree, and a version number can be determined from the ports Makefile, then the version number from the Makefile will be used to determine whether the installed package is up-to-date or requires updating.
If no origin for a package can be found, or if the ports Makefile cannot be located, pkg_version will search for the package in the ports collection index file (typically /usr/ports/INDEX-6). Any matching version number(s) there will be used to determine whether the installed package is up-to-date or requires updating.
Generally, using the version number from a ports Makefile will provide a more accurate result, since, unlike the index file, it provides an unambiguous current version number, even when multiple versions of a port exist in the ports collection. Moreover, the ports collection index file is only updated at intervals, meaning that it may not completely reflect the version numbers of the software contained in the ports collection.
Each package name is printed, along with a one-character status flag: