HostOnNet Blog

dpkg

Installing a .deb Package

To install .deb file, run dpkg -i file-name.deb

Example

root@hontest:~# dpkg -i mysql-apt-config_0.3.5-1debian8_all.deb 
Selecting previously unselected package mysql-apt-config.
(Reading database ... 111640 files and directories currently installed.)
Preparing to unpack mysql-apt-config_0.3.5-1debian8_all.deb ...
Unpacking mysql-apt-config (0.3.5-1debian8) ...
Setting up mysql-apt-config (0.3.5-1debian8) ...
OK
root@hontest:~#

Remove a Package

dpkg --purge PACKAGE-NAME

Force Remove a Package

dpkg --purge --force-all PACKAGE-NAME

List Installed Packages

dpkg -l

To check if a package is already installed, use dpkg -l with grep.

dpkg -l | grep PACKAGE-NAME

To see which Package Provide a command

To find which package provides a command, run dpkg -S

root@hon-pc-01:/# dpkg -S */bin/nmap
nmap: /usr/bin/nmap
root@hon-pc-01:/# 

You can also run

dpkg -S nmap

That will search for all files with nmap in its name.


Posted in Ubuntu