DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Yong has posted 5 posts at DZone. View Full User Profile

Linux Bash: How To Quickly Backup And Reinstall A Set Of Packages

04.07.2011
| 4255 views |
  • submit to reddit
        // description of your code here
How to quickly backup and reinstall a set of packages after a crash, mistake.
dpkg --get-selections | grep -v deinstall > ~/InstalledPackages.list
grep -ve ^# -e ^$ /etc/apt/sources.list > ~/InstalledSources.list

dpkg --set-selections < ~/InstalledPackages.list