4

How do I list the contents of a package that I just installed? This command:

dpkg --contents filename.deb

requires that I know where the .deb file is. I don't feel like I need to know that, and if I do, please tell me where they go when I do apt-get install.

5 Answers 5

9

Use Synaptic Package Manager. Install it with

sudo apt-get install synaptic

Then go to Installed section, select a package then right-click to show its properties.

enter image description here

If you want to do it in Terminal, there is no need for Synaptic:

dpkg-query -L <package_name>

Package name is without .deb extension or version information (e.g. vlc, evince).

2
  • 1
    That's a nice gui, but do you also know a command line method? Jun 14, 2014 at 12:03
  • 7
    Yes: dpkg-query -L <package_name>
    – Cornelius
    Jun 14, 2014 at 12:05
4

This is another way where it doesn't matter whether the package is already installed or not.

install the apt-file helper package

apt install apt-file 

then run the apt-file list command

example (here for a python package installed from the repository):

apt-file list virtualenvwrapper

Result

virtualenvwrapper: /etc/bash_completion.d/virtualenvwrapper
virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1-nspkg.pth
virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1.egg-info/PKG-INFO
virtualenvwrapper: /usr/lib/python2.7/dist-packages/virtualenvwrapper-4.3.1.egg-info/SOURCES.txt

etc etc etc

virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/search.html
virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/searchindex.js
virtualenvwrapper: /usr/share/doc/virtualenvwrapper/html/tips.html
virtualenvwrapper: /usr/share/python/ns/virtualenvwrapper
virtualenvwrapper: /usr/share/virtualenvwrapper/virtualenvwrapper.sh
virtualenvwrapper: /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh

More about apt-file:

apt show apt-file
Package: apt-file
Version: 3.1.5
Priority: optional
Section: universe/admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: APT Development Team <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 84.0 kB
Depends: perl:any, apt (>= 1.3~exp1~), libapt-pkg-perl, liblist-moreutils-perl, libregexp-assemble-perl
Breaks: apt-venv (<< 1.0.0-1~), command-not-found (<< 0.2.38-2~), devscripts (<< 2.15.10~)
Download-Size: 25.5 kB
APT-Manual-Installed: yes
APT-Sources: http://de2.archive.ubuntu.com/ubuntu bionic/universe amd64 Packages
Description: search for files within Debian packages (command-line interface)
 apt-file is a command line tool for searching files contained in packages
 for the APT packaging system. You can search in which package a file is
 included or list the contents of a package without installing or fetching it.
1
  • 1
    This is a good way to list out contents of a package but you may need sudo on some steps and you also need to run sudo apt-file update to populate the cache that it uses before being able to list out contents of installed packages.
    – NeilG
    May 15, 2023 at 8:46
3

For those who might like to see the contents of a package before it's installed, the package can first be downloaded with apt-get and then inspected.

apt-get download [package-name]
dpkg --contents [downloaded-file]
1

To get to know the list of most recently installed softwares via any method (synaptic, terminal, etc.), type in the command:

cat /var/log/dpkg.log | grep "\ install\ "

To list only the names of recently installed packages, type in the command:

awk '$3~/^install$/ {print $4;}' /var/log/dpkg.log

Credit goes to: Alvin Row

1

If you just installed that package, the package .deb is expected to still be in the cache:

ls /var/cache/apt/archives/*<package-name>*

Then you can run dpkg --contents ... against that .deb file. I think that's a practical tip to know, although the dpkg-query tool is certainly better overall, it's just yet another tool to learn about...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .