APT cheat sheet - janosgyerik/cheatsheets GitHub Wiki
Various tips on debian's apt utilities like apt-get, apt-cache, apt-file, etc.
- netselect: A program which determines the fastest server from a list of hosts given on the command line.
- netselect-apt: A program which generates a sources.list file using the best debian mirror.
netselect-apt program can be found in the netselect source package. To install the netselect source package, add appropriate deb-src lines to /etc/apt/sources.list like:
deb-src http://http.us.debian.org/debian testing main contrib non-free deb-src http://non-us.debian.org/debian-non-US testing/non-US main contrib non-free
then
apt-get update apt-get source netselect
The above procedure will generate a directory with the netselect source, named for example netselect-0.3.ds1.
To generate a sources.list file for the testing distribution, run ./netselect-0.3.ds1/netselect-apt testing.
apt-get remove pkg1 pkg2+
Remove pkg1 and install pkg2.
-u
Causes APT to show the complete list of packages which will be upgraded (when doing apt-get upgrade or apt-get dist-upgrade).
apt-get -t dist install pkg
Install pkg from distribution dist.
apt-get install package=version
Install a specific version of a package.
dpkg -S file
Search for a filename in installed packages.
dpkg -L package
List files installed from package.
apt-file update
Update the database of files all packages contain.
apt-file search file
Search for a filename in all packages.
apt-get -b source pkgname
Automatically build the downloaded package.
dpkg-buildpackage -rfakeroot -uc -b
Build the package later, do this from within the directory that was created after downloading the source package.
dpkg -i file.deb
apt-get build-dep pkg
Install the packages required for pkg to be built. (Sources must be installed separately by apt-get source.)
apt-show-versions -u
Display a list of upgradeable packages.
apt-cache depends pkgname
apt-cache rdepends pkgname
apt-cache search -n ^apt-- Debian Documentation Project
- APT HOWTO