Search
List all installed packages:
1
$ dpkg -lList all recently installed packages:
1
$ zcat -f /var/log/dpkg.log* | grep "\ install\ " | sortShow the changelog of a package (here, the linux kernel of Ubuntu):
1
$ aptitude changelog linux-genericWhich package contain a given file:
1
$ apt-file search file_to_searchGet the list of files of a package:
1
$ apt-file list package_nameExtract content of a package:
1
$ ar vx mypackage.deb
Install
Install a package from a lower-priority repository, like the backport repository:
1
$ apt-get -t squeeze-backports install my-packageForce reinstallation of a package:
1
$ apt-get -d --reinstall install my-package2$ dpkg --install --force-confmiss /var/cache/apt/archives/my-package.deb
Upgrade
Upgrade package listing and metadata:
1
$ sudo apt updateForce yes so that package maintainer’s version of config files always prevails:
1
$ sudo apt upgrade -y --force-yes
Holding
Hold a package with either dpkg or aptitude:
1
$ echo "kdenlive hold" | dpkg --set-selectionsor:
1
$ aptitude hold kdenliveUnhold a package:
1
$ echo "kdenlive install" | dpkg --set-selectionsor:
1
$ aptitude unhold kdenliveList holded packages:
1
$ dpkg --get-selections | grep hold
Uninstall
Uninstall a package thoroughly (both program files and configuration):
1
$ apt-get remove --purge my_packageForce removal of a package while ignoring all dependencies:
1
$ dpkg --remove --force-depends libsomethingRemove orphaned packages:
1
$ deborphan | xargs apt-get -y remove --purge
Clean-up
Clean aptitude local cache:
1
$ apt-get cleanRemove dpkg lock file:
1
$ rm /var/lib/dpkg/lock