Technology and General Blog

This tutorial clarifies how to see dpkg and apt historical past in Debian-centered Linux distributions.

After examining this tutorial, you will know how to obtain data about mounted, eradicated, and upgraded offers making use of instructions apt, dpkg-query, and looking at dpkg logs. There are recommendations to develop a checklist of mounted deals, set up all shown packages on a new laptop or computer, and supplemental apt and dpkg strategies.

See put in deals employing apt

The command down below prints a list of all software put in by way of the apt/apt-get deals supervisor.

Listing installed packages with dpkg-question

dpkg-question is a command to display information on offers from the dpkg database.

Count all installed packages

Making use of dpkg-query, you can get a complete depend of all set up packages. The -f flag will listing all binary offers only, then the wc command counts all detailed offers:

sudo dpkg-question -f ‘$binary:Package dealn’ -W | wc -l

As you can see, there are 2802 mounted deals. 

See set up offers examining logs

You can study new apt exercise (installation, removing, up grade) by looking at the log /var/log/apt/history.log as revealed beneath:

cat /var/log/apt/heritage.log

To get information on offers installed utilizing dpkg, you want to go through dpkg logs found at /var/log. You can read through the existing log by jogging the command beneath:

grep ” install ” /var/log/dpkg.log

To check out the previous log,  see the file /var/log/dpkg.log.1.

grep ” set up ” /var/log/dpkg.log.1

Examining compressed logs is the very same process but with zgrep alternatively of grep, as shown in the case in point below.

zgrep ” set up ” /var/log/dpkg.log.10.gz

If you want to see all compressed logs at the moment, you can use a wildcard like in the adhering to illustration:

zgrep ” install ” /var/log/dpkg.log.*.gz

Checklist taken off packages

You also can checklist taken out deals by reading through logs by changing “ install” with “remove”, as demonstrated in the picture under.

grep “eliminate ” /var/log/dpkg.log

As with the former illustration, you can also use the zgrep command and a wildcard to browse all compressed logs, as demonstrated in the screenshot underneath.

zgrep “take away ” /var/log/dpkg.log.*.gz

Checklist upgraded offers

To demonstrate upgraded offers swap “install” or “remove “ with “upgrade”, as revealed in the case in point underneath.

grep “enhance ” /var/log/dpkg.log

Use zgrep to read compressed logs.

zgrep “update ” /var/log/dpkg.log.10.gz

As with preceding examples, you also can use a wildcard.

zgrep “update ” /var/log/dpkg.log.*.gz

Export record of put in offers to set up on a new machine

You can build a listing of installed packages, then import it to a new gadget to put in the very same application.

To develop a record of put in offers, you can do a comparable course of action as the a single made use of to depend put in offers, as proven down below. As an alternative of counting, the following command creates a list named installedpackages.

sudo dpkg-query -f ‘$binary:Packagen’ -W > installedpackages

On the computer system you want to set up the similar packages run:

sudo xargs -a installedpackages apt put in

In the screenshot under, the apt was executed on the very same laptop or computer the record was produced therefore, it detected offers are currently put in.

Updating out-of-date packages

You can use the command apt to verify for out-of-date offers to update by functioning the command below:

sudo apt –resolve-lacking update

Repairing dependencies or damaged packages

To correct dependencies or broken packages, after working apt-get update, execute the command down below.

About apt and dpkg

  • APT (Innovative Package Instrument) automates packages retrieval, configuration (like dependency resolution), and installation. It can be regarded the major offers manager in some Debian-based mostly Linux distributions (including Debian alone) or a entrance-conclusion for the dpkg offers supervisor.
    The principal benefit of APT around DPKG is its capability to solve dependencies and keep track of updates. Apt is also made use of for bundle elimination, updates, and this tutorial to retrieve facts.
  • DPKG is the Debian offer supervisor utilized by APT. As mentioned beforehand, although it is a large amount greater than compilating, it has disadvantages ahead of APT. It handles specific deals and does not resolve dependencies. Continue to, DPKG involves fascinating applications like the dpkg-question outlined in this tutorial. Other instruments incorporate dpkg-break up, dpkg-statoverride, dpkg-set off, dpkg-divert. Dpkg consist of the next growth resources: dpkg-supply, dpkg-gencontrol, dpkg-shlibdeps, dpkg-genchanges, dpkg-buildpackage, dpkg-dist and dpkg-parsechangelog.

For supplemental details on the apt/apt-get deals manager, visit the person web page https://linux.die.web/male/8/apt-get.

For added information on dpkg, visit the male webpage


As you can see, displaying set up, removed and upgraded software package is an uncomplicated endeavor any Linux user amount can execute with a several commands. Linux features a assortment of flexible commands and resources to deal with and administrate packages in a personalized way. For illustration, obtaining the full depend of mounted programs in Microsoft Home windows may well be more durable or unattainable without the need of the help of an exterior device.

Finding out basic duties like the discussed in this tutorial could conserve you a great deal of time, as tested in the section describing how to export a checklist of deals to put in on a new device, particularly useful when you require to create a comparable serverand cloning isn’t an alternative.

Mastering to administer and manage offers is critical and primary expertise any user must-have.

I hope this tutorial was helpful. Keep subsequent Linux Hint for a lot more Linux ideas and tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *