Skip to content

This document is a WORK IN PROGRESS.
This is just a quick personal cheat sheet: treat its contents with caution!


dpkg

dpkg (Debian package manager), is a tool to install, build, remove and manage Debian packages. The primary and more user-friendly front end for dpkg is apt.


Table of content


Use

  • Print dependencies of a .deb package:

    $ dpkg -I /path/to/your/packagename.deb | grep -E "Depends|Recommends|Suggests|Pre\-Depends" | tr -d "|," | sed "s/([^)]*)/()/g" | tr -d "()" | tr " " "\n" | grep -Ev "Depends|Recommends|Suggests|Pre\-Depends" | xargs
    
  • Check if some packages are installed (e.g. the list of dependencies printed by the previous command):

    $ dpkg-query -l packagename1 packagename2 packagename3
    
    or
    $ dpkg -s packagename1 packagename2 packagename3
    

  • Install a .deb package:

    $ dpkg -i packagename
    
  • Find what package owns a command:

    $ dpkg -S `which <command>`
    

If this cheat sheet has been useful to you, then please consider leaving a star here.