Linux - Package management


How to list packages in the order they were installed ?

Usage :

zgrep -ih 'status installed' /var/log/dpkg.log* | sort | uniq | less

Example :

install + upgrade history of nano :

zgrep -ihE ' installed|upgrade' /var/log/dpkg.log* | sort | uniq | grep nano

How to disable installation of recommends and suggests packages ?

echo -e 'APT::Install-Recommends "0";\nAPT::Install-Suggests "0";' >> /etc/apt/apt.conf.d/60recommends

How to find which package a specific file belongs to ?

  1. Get details on the file itself : a binary may be a symlink to another binary.
    which rename
    rename: /usr/bin/rename.ul /usr/bin/rename /usr/bin/X11/rename.ul /usr/bin/X11/rename /usr/share/man/man2/rename.2.gz /usr/share/man/man1/rename.1.gz
  2. Ask the package management tools :
    dpkg-query -S /usr/bin/rename.ul
    util-linux: /usr/bin/rename.ul
Consider having a look at the Debian packages page also.

How to list files of an uninstalled package ?

  1. Search your package name on the Debian packages page
  2. Select it from the results
  3. Scroll to the bottom of the page
  4. Click on the files list hyperlink matching your architecture