{"id":1659,"date":"2024-03-07T00:00:00","date_gmt":"2024-03-07T05:00:00","guid":{"rendered":"https:\/\/molecularsciences.org\/content\/?p=1659"},"modified":"2024-03-09T19:09:36","modified_gmt":"2024-03-10T00:09:36","slug":"dpkg-cheat-sheet","status":"publish","type":"post","link":"https:\/\/molecularsciences.org\/content\/dpkg-cheat-sheet\/","title":{"rendered":"dpkg Cheat Sheet"},"content":{"rendered":"\n<p><code>dpkg<\/code> is a low-level package management command-line tool used in Debian-based systems to install, configure, and remove software packages. This cheat sheet covers essential <code>dpkg<\/code> commands for managing packages.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Introduction:<\/strong><\/h4>\n\n\n\n<p><code>dpkg<\/code> directly interacts with the Debian package system, providing low-level package management capabilities. It is the underlying tool for package management on Debian-based systems.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Basic Commands:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>sudo dpkg -i [package.deb]<\/code><\/td><td>Install a .deb package file.<\/td><\/tr><tr><td><code>sudo dpkg -r [package]<\/code><\/td><td>Remove (uninstall) a package.<\/td><\/tr><tr><td><code>sudo dpkg -P [package]<\/code><\/td><td>Purge a package, removing its configuration files.<\/td><\/tr><tr><td><code>sudo dpkg -L [package]<\/code><\/td><td>List files installed by a package.<\/td><\/tr><tr><td><code>sudo dpkg -l<\/code><\/td><td>List all installed packages.<\/td><\/tr><tr><td><code>sudo dpkg -s [package]<\/code><\/td><td>Display information about a package.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Querying and Searching:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>dpkg-query -l<\/code><\/td><td>List all installed packages.<\/td><\/tr><tr><td><code>dpkg-query -L [package]<\/code><\/td><td>List files installed by a package.<\/td><\/tr><tr><td><code>dpkg-query -S [file]<\/code><\/td><td>Find the package providing a specific file.<\/td><\/tr><tr><td>`dpkg -l<\/td><td>grep [keyword]`<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Updating and Clearing:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>sudo dpkg --configure -a<\/code><\/td><td>Configure all unpacked but unconfigured packages.<\/td><\/tr><tr><td><code>sudo dpkg-reconfigure [package]<\/code><\/td><td>Reconfigure a package.<\/td><\/tr><tr><td><code>sudo dpkg --clear-selections<\/code><\/td><td>Clear the package selections.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Information and Troubleshooting:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>dpkg --get-selections<\/code><\/td><td>List all installed packages and their status.<\/td><\/tr><tr><td><code>dpkg-reconfigure [package]<\/code><\/td><td>Reconfigure a package.<\/td><\/tr><tr><td><code>sudo dpkg --audit<\/code><\/td><td>Check for broken dependencies and missing packages.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Miscellaneous:<\/strong><\/h4>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Command<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><code>sudo dpkg --add-architecture [architecture]<\/code><\/td><td>Add a new architecture (e.g., <code>i386<\/code> for 32-bit) to the system.<\/td><\/tr><tr><td><code>sudo dpkg --remove-architecture [architecture]<\/code><\/td><td>Remove an architecture from the system.<\/td><\/tr><tr><td><code>sudo dpkg -I [package.deb]<\/code><\/td><td>Display information about a .deb package file.<\/td><\/tr><tr><td><code>dpkg --help<\/code><\/td><td>Display help and usage information for <code>dpkg<\/code>.<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n\n\n<p><code>dpkg<\/code> is a fundamental tool for managing packages on Debian-based systems. This cheat sheet covers essential commands for installing, removing, querying, and troubleshooting packages using <code>dpkg<\/code>. Whether you are a system administrator or a Debian user, these commands will help you efficiently manage software packages on your system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>dpkg is a low-level package management command-line tool used in Debian-based systems to install, configure, and remove software packages. This cheat sheet covers essential dpkg commands for managing packages. Introduction: dpkg directly interacts with the Debian package system, providing low-level package management capabilities. It is the underlying tool for package management on Debian-based systems. Basic [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1805,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,265],"tags":[35],"class_list":["post-1659","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-linux","category-reference","tag-linux"],"_links":{"self":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1659","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/comments?post=1659"}],"version-history":[{"count":1,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1659\/revisions"}],"predecessor-version":[{"id":1660,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/posts\/1659\/revisions\/1660"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media\/1805"}],"wp:attachment":[{"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/media?parent=1659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/categories?post=1659"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/molecularsciences.org\/content\/wp-json\/wp\/v2\/tags?post=1659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}