list contents of a deb package in Ubuntu

At times, it gets necessary for us to view the contents of a deb package we are about to install. It deserves adequate attention if we are installing the package from unofficial sources. Although, we always recommend you to always install packages from official sources. But, that may not happen all the time. You may require a package that just isn’t available. In that case, we are left with no option. So, just make sure that you do install a safe package. In this article, we cover how to list contents of a deb package in Ubuntu.

The command-line utility which we utilize here is dpkg. dpkg is Debian’s Package Manager. It is mainly used to install, upgrade and remove packages. Or, in other words, it is used to manage packages.

Also, listing contents of a deb package won’t require superuser privileges. Running the command as a regular user is enough.

list contents of a deb package in Ubuntu

As already discussed, we mainly use dpkg to list contents of a package. We assume that you have .deb package available. Use following syntax to list contents of a .deb package –

dpkg -c <package-name.deb>

or, we can also use –

dpkg --contents <package-name.deb>

Both the above options would yield similar outcomes. Let’s say, we have ABC.deb package available and we want to list its contents. Therefore, we can use –

dpkg -c ABC.deb

or,

dpkg --contents ABC.deb

One of the advantages of listing contents of a deb package is that we can now view the files as well as the locations where those files stay after installation. This way, it becomes pretty easy for us to manage installed files. Just from here itself, we would get an idea of how things would change in our distribution after the package gets installed.

In conclusion, we have covered how to list contents of a deb package in Ubuntu using dpkg command-line utility.