Disclaimer don't get the wrong idea about what you've found here

What appears below are my personal notes I wish were part of my long-term memory but don't always seem to fit. I strive for accuracy and clarity and appreciate feedback. If applying any of this information anywhere, confirm for youself the correctness of your work as what you see below might very well be, albeit unintentionally, incorrect or misleading. These notes are here as an easy reference for myself.

Information worthy of a more formal presentation will appear elsewhere than this "Scratch" area. - ksb


KSB's package manager notes

My attempt at keeping straight the plethora of package managers I use (with the exception of FreeBSD).

Table of Contents References

Debian, Ubuntu, etc.

List all packages currently installed:
$ dpkg -l
Search for availble "foo" related packages:
$ apt-cache search foo
To see details of availble "foo" related packages:
$ apt-cache search -f foo
or
$ apt-cache showpkg foo
Install the "foo-server" package:
$ apt-get install foo-server
Remove the "foo-server" package:
$ apt-get remove foo-server
Remove the "foo-server" package and all it's config files:
$ apt-get purge foo-server
Find the package that owns a specific file:
$ dpkg -S /path/to/file
Get updates about latest packages:
$ apt-get update
Upgrade any installed packages:
$ apt-get upgrade

MacPorts

To list, or search for foo in, all ports possible for installation:
$ port list
$ port search foo
To list information about & variants within port foo:
$ port info foo
$ port variants foo
To list dependencies required by port foo:
$ port deps foo
To list ports dependent on port foo:
$ port dependents foo
To install port foo with variant bar:
$ sudo port install foo +bar
To deactivate port foo (so you can install a different variant):
$ sudo port deactivate foo
To uninstall port foo:
$ sudo port uninstall foo
To list all ports currently installed:
$ port installed
To find the port that provides file /path/to/foo:
$ port provides /path/to/foo
To list the contents of port foo:
$ port contents foo
To update MacPort itself and it's list ports (the -d is 'debug' to show more):
$ sudo port -d selfupdate
To list outdated ports (after a selfupdate):
$ port outdated
To upgrade outdated or installed ports (after a selfupdate):
$ port upgade outdated
$ port upgrade installed
To clean out and remove inactive ports (inactive ports appear to be past versions of upgraded ports):
$ port uninstall inactive

rpm

To install package 'foo':
# rpm -ivh foo
To remove package 'foo':
# rpm -e foo

For either of these commands: --test can be added to check what would happen without doing it or -vv to be real verbose about what it's doing

To see if package foo is installed:
$ rpm -q foo
If you only know part of the name of the package -qa will list all installed packages, so to list all packages with foo in their name:
$ rpm -qa | grep foo
To list all the files in package 'foo':
$ rpm -ql foo
To find the package that has file /path/to/foo in it:
$ rpm -q --file /path/to/foo

yum

To update all installed packages:
# yum -y update
To check to see what has updates ready:
# yum check-updates
To install the latest version of package foo:
# yum install foo
To list all packages on the server that have foo in their name:
$ yum list '*foo*'
To get detailed information about package foo:
$ yum info foo

Keith S. Beattie is responsible for this document, located at http://dst.lbl.gov/~ksb/Scratch/package_managers.html, which is subject to LBNL's Privacy & Security Notice, Copyright Status and Disclaimers.

Last Modified: Monday, 25-Feb-2013 16:57:57 PST