Command-line Package Tools

Command-line package commands for Debian and Ubuntu-type systems that you should know:

apt-get update
resynchronize the package index files
apt-get dist-upgrade
install the newest versions of all packages currently installed and handle changing dependencies
apt-get install PKG
install a package and figure out dependancies
apt-get remove PKG
remove a package
apt-get clean
clear out the local repository of retrieved package files
apt-cache showpkg PKG
displays information about the package
apt-cache search REGEX
search all available package lists for a regex pattern
dpkg-query --list PATTERN
list installed packages matching given pattern
dpkg-query --status PKG
report the status of specified package
dpkg-query --listfiles PKG
list files installed to your system from a package
dpkg-query --search FILENAME
search for a filename from installed packages
sudo dpkg --install DEBPKGFILE
install a .deb package