Happy Friday. This week has been a long one, I started going to a HIIT (High Intensity Interval Training) workout gym and, to put it mildly, everything hurts. Despite not being able to stand up straight because my abs hurt, I still had Little Bits of Linux this week so let's dive in.

Today's LBOL is all about dpkg!

dpkg is the command line tool for the Debian package manager. It's used to install, remove, and do other fun management things with, well...Debian packages.

For those who don't know, Debian is a type of GNU/Linux distro. For example, Ubuntu is a Debian distro.

man page description

 dpkg is a tool to install, build, remove and manage Debian packages. The
 primary and more user-friendly front-end for dpkg is aptitude(1). dpkg
 itself is controlled entirely via command line parameters, which consist of
 exactly one action and zero or more options. The action-parameter tells dpkg
 what to do and options control the behavior of the action in some way.
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The
list of supported actions can be found later on in the ACTIONS section. If
any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the
parameters given to it, but no specific options are currently passed to them,
to use any such option the back-ends need to be called directly.

why it's useful

This week I used dpkg to install a custom built debian package. Usually, we can install pacakges to a debian system using the apt command if that package is already in a repository. However, there are cases where we need to package our own programs with special commands or files and for that we use dpkg. With dpkg you can build your own programs from source and then use something like dpkg-deb -b directory to build your package and then use dpkg -i to install it.

For what I needed to do this week, I already have a .deb file (Debian package). I needed to see the insides of it to understand where things were being placed and what POSTINST (post installation) script was being ran. To do this, run dpkg-deb -c deb_file.deb to list the contents and dpkg-deb -x deb_file.deb deb_file_dir to extract those contents into a directory (deb_file_dir in this case).

Check out other fun things to do with dpkg with man dpkg. See you next week for other commands I've found useful while doing Little Bits of Linux.