Determine what software is installed on a system
Author: name contact BSD flavour
Reviewer: name contact BSD flavour
Reviewer: Chris Silva racerx@makeworld.com FreeBSD/OpenBSD
Concept
Recognize that on BSD systems, software and dependencies are tracked by a package manager if the software was installed using packages(((packages))), ports(((ports))) or pkgsrc(((pkgsrc))). Be familiar with querying the package manager to determine what software and their versions are installed on the system.
Introduction
TODO: what about non-packages?
Examples
pkg_info (((pkg_info))) -a shows all installed packages (TODO: is -a needed on all platforms)
The following is quick example from a NetBSD mail server. (Note that the MTA software is not listed with pkg_info because it is included with the base system (i.e. the core operating system).
# pkg_info
digest-20060826 Message digest wrapper utility
bash-3.2.9 The GNU Bourne Again Shell
spamd-20070405 OpenBSD spam deferral daemons and tools
TODO add some more examples
TODO mention about FreeBSD's -x
The following example for FreeBSD's pkg_info uses the -W switch to show what package a file belongs too. (You can also use an full path to the filename.)
# pkg_info -W pal2rgb
/usr/local/bin/pal2rgb was installed by package tiff-3.5.7
With pkgsrc, this can be done with the -F switch which shows details for the package owning the file (using full path). Use -Fe to just show the package name, for example:
$ pkg_info -Fe `which ps2pdf`
ghostscript-gnu-8.15nb3
(Notice this example runs which to get full path of the command.)
Practice Exercises
More information
pkg_info(1)