Ubuntu, Debian & distros based on these uses .deb files for installation of softwares/applications on the system & in order to install these deb, we use dpkg package manager. With dpkg, we can install, remove packages along with some other functions.
In this tutorial, we will learn to use dpkg command with examples.....
(Recommended Read: How to install UTorrent on Ubuntu Systems)
(Also Read: How to install WireShark on Linux (CentOS/Ubuntu))
dpkg command with examples
List all installed packages or a package details
To list all the installed packages on the system, use option ‘l’ with the dpkg command,
$ sudo dpkg -l
We can also list out installed package details like version, short description with same command , i.e.
$ sudo dpkg -l package_name
Install or upgrade a package
To install a package on Ubuntu, we will use option ‘i’ with dpkg command,
$ sudo dpkg -i package_name
Same command is also used to upgrade a package, if package is already installed run the same command & package will be upgraded or else it will install the package if it was previously not installed on the system.
Install a number packages recursively
To install a number of packages from a directory recursively, execute the following command from terminal,
$ sudo dpkg -R directory_name
Remove a package
To remove a package from system, use option ‘r’ with dpkg command,
$ sudo dpkg -r package_name
Remove a package & also remove the configuration files
To remove a package along with all it’s configuration files, use option ‘P’ with dpkg command,
$ sudo dpkg -P package_name
List all the files for installed package
To find out all the files on the system that a installed packge uses, we will use option ‘L’,
$ sudo dpkg -L package_name
Find out what package uses the file
We can also mention a file & find out what package is using that file with option ‘S’
$ sudo dpkg -S /file_path
List details for the package
To get all the details about a package like version, package group, architecture, maintainer, dependency etc, we can use option ‘p’ with the dpkg command,
$ sudo dpkg -p package_name
We now end this tutorial for dpkg command with examples . We have only listed out some important commands, there are some other options that you can use dpkg, if what you are looking for is not listed here, you can always use ‘--help’ or read man page. Please do share any feedback or queries using the comment box below.
If you think we have helped you or just want to support us, please consider these :-
Connect to us: Facebook | Twitter | Google Plus
Donate us some of your hard earned money: [paypal-donation]
Linux TechLab is thankful for your continued support.