Enhancing Skills

dpkg: Package management system used on Debian-based distributions

Command: dpkg

dpkg is the core package management system for Debian-based distributions (such as Ubuntu and Debian). It provides the basic functionality for installing, configuring, and removing software packages in .deb format.


Sample Command and Output:

$ dpkg

Description:

  • dpkg: Launches the dpkg command-line tool, allowing users to manage Debian packages on the system.

Additional Commands and Sample Outputs:

  • dpkg -i package_name.deb: Install a .deb package. Sample Command and Output:
  $ sudo dpkg -i example-package.deb
  Selecting previously unselected package example-package.
  (Reading database ... 123456 files and directories currently installed.)
  Preparing to unpack example-package.deb ...
  Unpacking example-package (1.0-1) ...
  Setting up example-package (1.0-1) ...
  Processing triggers for man-db (2.9.1-1) ...

Description:

  • dpkg -i <package_name.deb>: Installs the specified Debian package.
  • Installs all files listed in the package into the appropriate locations and registers the package with the package management system.
  • dpkg -r package_name: Remove an installed package. Sample Command and Output:
  $ sudo dpkg -r example-package
  (Reading database ... 123456 files and directories currently installed.)
  Removing example-package (1.0-1) ...
  Processing triggers for man-db (2.9.1-1) ...

Description:

  • dpkg -r <package_name>: Removes the specified package from the system but leaves its configuration files.
  • dpkg -P package_name: Purge a package, including its configuration files. Sample Command and Output:
  $ sudo dpkg -P example-package
  (Reading database ... 123456 files and directories currently installed.)
  Removing example-package (1.0-1) ...
  Purging configuration files for example-package (1.0-1) ...
  Processing triggers for man-db (2.9.1-1) ...

Description:

  • dpkg -P <package_name>: Completely removes the package and all of its associated configuration files.
  • dpkg -l: List all installed packages. Sample Command and Output:
  $ dpkg -l
  Desired=Unknown/Install/Remove/Purge/Hold
  | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  ||/ Name           Version        Architecture Description
  +++-==============-==============-============-=================================
  ii  example-package 1.0-1         amd64        An example package
  ii  bash            5.0-6ubuntu1.1 amd64        GNU Bourne Again SHell

Description:

  • dpkg -l: Lists all installed packages along with their status, version, architecture, and description.
  • dpkg -s package_name: Display detailed information about an installed package. Sample Command and Output:
  $ dpkg -s example-package
  Package: example-package
  Status: install ok installed
  Priority: optional
  Section: utils
  Installed-Size: 1234
  Maintainer: Example Maintainer <maintainer@example.com>
  Architecture: amd64
  Version: 1.0-1
  Description: An example package
   This is an example package used for demonstration purposes.

Description:

  • dpkg -s <package_name>: Shows detailed information about the specified installed package, including its status, version, architecture, and description.
  • dpkg -L package_name: List files installed by a package. Sample Command and Output:
  $ dpkg -L example-package
  /.
  /usr
  /usr/share
  /usr/share/doc
  /usr/share/doc/example-package
  /usr/share/doc/example-package/README

Description:

  • dpkg -L <package_name>: Lists all the files installed by the specified package, including documentation and configuration files.
  • dpkg -S filename: Search for a package that owns a specific file. Sample Command and Output:
  $ dpkg -S /bin/bash
  bash: /bin/bash

Description:

  • dpkg -S <filename>: Searches the database of installed packages to find out which package installed the specified file.

Note: dpkg is a foundational tool for package management on Debian-based distributions, handling the installation, removal, and querying of .deb packages.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.