Charlie Harvey

Debian Tip: Get a list of all installed packages with dpkg

I like to make sure that I always have a listing of all the files I have on my Debian boxen. Fortunately dpkg has a quick way of doing just that. # dpkg --get-selections > /path/to/mybackup.txt I run that once a day or so as a cron job dumping to a file, that file will be in my usual rsync backup. That means that if my harddrive dies I can simply # dpkg --set-selections < /path/to/mybackup.txt # apt-get -u dselect-upgrade to have a full restore of all my packages.


  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.