Insight: dpkg Command Tutorial For Beginners With Examples
This tutorial is for you if you are an user on Ubuntu or Debian-based system. dpkg is a tool to deal with Debian packages. It is a built-in command for Debian package management. It let you to install Debian packages in from system. You can also build, remove and manage Debian package.
This post is intended for beginner level of users. If you are an expert Linux user then you might share this post to your friend who is learning Linux.
dpkg Command Tutorial For Beginners With Examples)
dpkg command syntax
dpkg [options] filename
Let’s go through the some of the example of dpkg command.
Install A Package Using dpkg
Run the following command to install a package using dpkg. Here the option -i initiate the installation procedure.
dpkg -i [package-name]
For example:
dpkg -i filename.deb
Remove A Package Using dpkg
Run the following command to remove the already installed package from the system. Option -r removes the package.
dpkg -r [package-name]
For example:
dpkg -r filename.deb
To View The Content Of A Package
Run the following command to view the content of a package in your system.
dpkg -c filename.deb
To Check The Location Of Packages Installed
Run the following command to check the location of packages installed in your system.
dpkg -L filename
To Install All Packages From A Directory
Run the following command to install all .deb files from a specific directory.
dpkg -R --install directoryname/
To List All Installed packages
To list out the installed packages in the system, you need to run the following command with -l option.
dpkg -l
To Unpack A package Using dpkg
If you want to unpack a package without installing then you need to run the following command.
dpkg --unpack [package-name]
For example:
dpkg --unpack filename.deb
Run the following command to configure package which you have already completed the process of unpacking.
dpkg --configure [filename.deb]
To Check If A package Is Installed Or Not
You need to run the following command to check if a package is installed or not
dpkg -s [Package]
For example:
dpkg -s filename.deb
To Purge A package
If you want to remove a package completely then you need to run the following command.
dpkg -P [package-name]
For example
dpkg -P filename.deb
To Display dpkg Version
dpkg –version
To List Out Available Options Of dpkg Command.
dpkg –help