Tips for using apt & dpkg


This is just my list of common commands for apt and dpkg, Debian's software package management system.


The list of locations that packages are loaded from is in /etc/apt/sources.list

Refresh the list of available packages

apt-get update

Search for a package

apt-cache search searchtext

Install a package

apt-get install pkg

Uninstall a package

apt-get remove pkg

Upgrade all installed packages

apt-get upgrade

Upgrade the kernel and base packages

apt-get dist-upgrade

Install a package that was downloaded as .deb file

dpkg -i file.deb

Reconfigure a package (if you missed a question when you first installed it)

dpkg-reconfigure pkg

Find which package a file belongs to

dpkg -S /path/file

List all the installed packages (that's the lower-case letter L, not a one)

dpkg -l

Find an installed package with regex on the name (those are backquotes)

dpkg -l `regex`

See exactly what files are in a package

dpkg -L pkg

See exactly what files are in a .deb file

dpkg -c file.deb

See metadata for a .deb file

dpkg -I file.deb