Instructions for using dpkg command on Linux Debian

This article will talk about the basics of package management in Debian and how to manage software packages using the dpkg command.

All Linux distributions come with a specific package manager. For Debian distributions based on Debian, the default package manager is 'apt' or 'apt-get' or the graphics software center. These package managers in turn rely on low-level dpkg tools to manage software packages.

This article will talk about the basics of package management in Debian and how to manage software packages using the dpkg command.

The dpkg command in the Linux distribution is based on Debian

  1. Learn about package management in Debian
  2. How to use dpkg command
    1. How to install software / packages with dpkg command
    2. List a list of currently installed packages
    3. Delete installed packages
    4. List the contents of a package
    5. Check if the package is installed
    6. Check the location of the installed package
    7. Displays detailed information about a package
    8. Install multiple packages simultaneously
    9. Extract a deb package
    10. Re-configure the deb package that has not been packaged
    11. Need more information about dpkg command?

Learn about package management in Debian

Package management in Debian uses several diverse package management tools - such as 'apt-get', 'aptitude', 'dpkg', 'apt-file', 'dselect', 'tasksel' and 'gdebi' - to manage software on the system. These tools are called package managers. Some, not all, these tools use dpkg low-level tool commands to provide advanced functionality.

The dpkg command allows you to easily install and remove software, as well as manipulate and upgrade the software seamlessly.

Picture 1 of Instructions for using dpkg command on Linux Debian

How to use dpkg command

How to install software / packages with dpkg command

You can use dpkg to install the software using the following command. This command can also upgrade a package, if it is already installed.

 dpkg -i package_name.deb 

The above command requires you to have a real .deb file on your computer.

List a list of currently installed packages

To list or display packages currently installed on a Debian-based distribution, you can use the following commands:

 dpkg -l search_pattern 

Picture 2 of Instructions for using dpkg command on Linux Debian

If you want to list all installed packages, just skip [search_pattern]:

 dpkg -l 

Delete installed packages

If you have installed a package but don't use it anymore, you can use the following command to uninstall it. This command removes the entire package, except for configuration files:

 dpkg -r package_name.deb 

List the contents of a package

You can use the following commands to list the contents of a package on your Linux computer:

 dpkg --contents package_name.deb 

You can also use -c instead of --contents.

 dpkg -c package_name.deb 

Check if the package is installed

Assuming you want to check if you have installed a specific package on your computer, use the following command to check:

 dpkg -s package_name.deb 

Check the location of the installed package

If you just want to find out where the package will be installed, use -L:

 dpkg -L package_name.deb 

Displays detailed information about a package

This command displays detailed information about a package:

 dpkg -p package_name.deb 

Install multiple packages simultaneously

If you have some deb files that you want to install, you can run the following command to install them all at once. Note that to do this, you must put all .deb files in the same directory:

 dpkg -R --install / deb-files-location / 

Extract a deb package

Sometimes you may want to decompress deb package to make changes to its files. Use this command to decompress the deb file:

 dpkg --unpack package_name.deb 

Configure the deb package that has not been packaged

After you've made changes to the files, use this command to configure and repackage them into a deb file to install:

 dpkg --configure pacakge_name 

Need more information about dpkg command?

If you want to know more about the dpkg command, you can use the command below. It shows detailed information about commands and dpkg options:

 dpkg --help 

Most Debian-based package managers rely only on dpkg to get things done. With the above commands, you can learn the basics, when all other installation methods fail.

See more:

  1. Basic Linux commands everyone needs to know
  2. Basic Shell commands in Linux
  3. Kali Linux commands from AZ and commonly used commands
Update 26 May 2019
Category

System

Mac OS X

Hardware

Game

Tech info

Technology

Science

Life

Application

Electric

Program

Mobile