Skip to: Site menu | Main content

Jon's Apt-Get Cheat Sheet

Recently a friend of mine converted his PC to Debian and wanted to know how to install software. I whipped up this little cheat sheet for Debian beginners to make things really easy.

Configuration Stuff

/etc/apt/apt.conf (or may be '/etc/apt/apt.conf.d/70debconf' on recent systems)
General config file for Apt.

/etc/apt/sources.list
List of sources for your system to use to retrieve packages. Will generally contain a couple of http or ftp servers, and possibly some CD-ROM references.

3 Commands You Can't Live Without

apt-get update
Retrieves the current list of packages from all servers in your sources.list. If you don't do this, your local list of available packages may not be up to date. Do it occasionally before doing a dist-upgrade or searching for a new package. The package lists are large: may result in several MB of data being retrieved from the internet.

apt-cache search progname
Search the package list for a specific program called progname. Actually a single-element keyword search, will find packages with this word in the description as well.

apt-get install progname
Will get the latest version of the specified package name from the relevant source and install it. If it is already installed, this will upgrade to the latest available version.

Other Useful Package Stuff

apt-get dist-upgrade
Will compare packages currently installed on your system to the versions listed in the package list, and upgrade to the latest versions.

apt-get autoclean
Deletes old (superseded) packages that are left lying around on disk. Run this every now and then to get back some of the disk space used by the local package archive. Put it in a Cron job if you really feel like it.

dpkg -r progname
Remove (uninstall) the listed package. This only removes the binaries and any startup scripts, but does not remove the config files. Reinstalling at a later date will then use your existing config files. Removing a package requires there be no other packages dependant on it: if it complains about dependancies, you need to remove those dependant packages first.

dpkg -P progname
Purge (fully uninstall) the listed package. This removes everything related to that package: binaries, startup scripts, config files, everything. Purging a package requires there be no other packages dependant on it: if it complains about dependancies, you need to remove those dependant packages first.

dpkg -i progname.deb
Install a package from a local Deb file on disk: if you download a .deb package directly from the internet, it can be installed directly this way.

dpkg -l progname
List version info / status of a currently installed package.

dpkg -L progname
List all files related to this currently installed package: if you've just installed something, and you don't know where it went, use this to find it.