APT Quick Reference

Basic "apt-get" usage

sudo apt-get install package
Downloads package and all of its dependencies, and installs or upgrades them.
sudo apt-get -u -V upgrade
List packages to be upgraded with their versions.
sudo apt-get remove [--purge] package
Removes package and any packages that depend on it
sudo apt-get purge -y $(dpkg --list |grep '^rc' |awk '{print $2}')
Purge packages removed, but not purged (rc)

Basic "apt-cache" usage

apt-cache search pattern
Searches packages and descriptions for pattern.
apt-cache show package
Shows the full description of package
apt-cache showpkg package
Shows a lot more detail about and its relationships to other packages.

Basic "dpkg" usage

dpkg-deb -e package_file.deb
Extract content of .deb file in current directory.
dpkg --list |grep "^rc" | cut -d " " -f 3 | xargs sudo dpkg --purge
Remove all rc packages.
dpkg -S /etc/bash.bashrc
How to find which package contains/supplies a certain file.
dpkg -l | awk '{ print $2 }' | tail -n+5 |tr '\n' ' '
List all packages installed in one line
dpkg -I package.deb
Get info about a package

Basic "aptitude" usage

aptitude download package_name
Download the dpkg file of package_name


  1. http://www.cyberciti.biz/ref/apt-dpkg-ref.html - APT and Dpkg Quick Reference Sheet

Nessun commento:

Posta un commento