Mastering Package Management system with Dpkg

Dpkg is a device to install, build, dispose of and manage Debian programs and is managed utterly through command line parameters, which consists of precisely one action and zero or extra options. The action parameter tells to dpkg, what to do and options to manipulate the conduct of the action is some way. This article explains about -“Mastering Package Management system with Dpkg”.
To get the options of dpkg, use the following command –
$ dpkg --help
The sample output should be like this –
Commands:
-i|--install           <.deb file name> ... | -R|--recursive <directory> ...
--unpack               <.deb file name> ... | -R|--recursive <directory> ...
-A|--record-avail      <.deb file name> ... | -R|--recursive <directory> ...
--configure            <package> ... | -a|--pending
--triggers-only        <package> ... | -a|--pending
-r|--remove            <package> ... | -a|--pending
-P|--purge             <package> ... | -a|--pending
-V|--verify            <package> ... Verify the integrity of package(s).
--get-selections       [<pattern> ...] Get list of selections to stdout.
--set-selections       Set package selections from stdin.
--clear-selections     Deselect every non-essential package.
--update-avail         [<Packages-file>] Replace available packages info.
--merge-avail          [<Packages-file>] Merge with info from file.
--clear-avail          Erase existing available info.
--forget-old-unavail   Forget uninstalled unavailable pkgs.
-s|--status            <package> ... Display package status details.
-p|--print-avail       <package> ... Display available version details.

Assertable features: support-predepends, working-epoch, long-filenames,
multi-conrep, multi-arch, versioned-provides.
.........................................................................
To install package, use the following commands as shown below –
$ sudo dpkg -i <File name>.deb
In the below commands VLC is the package name.
To remove the package, use the following command –
$ sudo dpkg -r vlc
To purge the package, use the following command –
$ sudo dpkg -P vlc
To verify the integrity package, use the following command –
$ sudo dpkg -V vlc
To get the status of package, use the following command –
$ sudo dpkg -s vlc
To display available version details of package, use the following command –
$ sudo dpkg -p vlc
To get the list of all packages, use the following command –
$ sudo dpkg -L
To search a specific package and its supported files, use the following command –
$ sudo dpkg -S vlc
To configure the package, use the following command –
$ sudo dpkg --configure vlc
To install the package from directory, use the following command –
$ sudo dpkg -R -i <Directory>/<package name >
To unpack the package, use the following command –
$ sudo dpkg -unpack <File name>.deb
To deselect every non-essential package, use the following command as shown below –
$sudo dpkg --clear-selections
To get the list packages concisely, use the following command as shown below –
$sudo dpkg -l
The sample output should be like this –
ri qt-at-spi:i386 0.4.0-3 i386 at-spi accessibility plugin for Q
ri qtchooser 52-gae5eeef- amd64 Wrapper to select between Qt deve
ri qtcore4-l10n 4:4.8.7+dfsg all Qt 4 core module translations
ri qtdeclarative5 0.6+16.04.20 amd64 transitional dummy package for On
ri qtdeclarative5 5.5.1-2ubunt amd64 Qt 5 declarative development prog
ri qtdeclarative5 5.5.1-2ubunt amd64 transitional dummy package Qt 5 Q
ri qtdeclarative5 5.5.1-2ubunt amd64 transitional dummy package for Qt
ri qtdeclarative5 1.3.1918+16. amd64 Transitional dummy package for Ub
ri qtdeclarative5 1.1.0+14.04. amd64 Unity Action QML Components
ri qttranslations 5.5.1-2build all translations for Qt 5
ri qtwayland5:amd 5.5.1-2build amd64 QtWayland platform plugin
ri readline-commo 6.3-8ubuntu2 all GNU readline and history librarie
ri remmina 1.1.2-3ubunt amd64 remote desktop client for GNOME d
ri remmina-common 1.1.2-3ubunt all common files for remmina remote d
ri remmina-plugin 1.1.2-3ubunt amd64 RDP plugin for remmina remote des
ri remmina-plugin 1.1.2-3ubunt amd64 VNC plugin for remmina remote des
ri rename 0.20-4 all Perl extension for renaming multi
...........................................
To print dpkg architecture, use the following command as shown below –
$sudo dpkg --print-architecture
The sample output should be like this –
amd64
In this articles, we have learnt about – Mastering Package Management system with Dpkg .In our next series of Linux articles, we will come up with more Linux based tricks and tips. Keep reading!!