How I Reinstall All Packages In Debian Based Linux Distros

Hello beautiful peoples!

Reinstalling all packages in Linux is a bit of a nuclear option that is usually (but not always) taken when the system is on the fritz. This can help fix issues that may have been caused by corrupted or missing files, dependencies, or configuration files. Reinstalling all packages in Linux can also be used to “clone” the operating system… well, kind of. You can export the list of installed packages on one PC and then use that list of packages to install exactly the same packages on another machine. How I Reinstall All Packages In Debian Based Linux Distros?

Become root:

su -

Export the list of installed packages:

dpkg --get-selections | grep -v deinstall | awk '{print $1}' > Installed.log

Now You can either reinstall all the packages on this machine OR copy the list to another OS and reinstall the listed packages (as root!) there…

apt-get install --reinstall $(cat Installed.log)

I hope this helps!

Catch you on the flip side,

AndrzejL

Avatar photo

AndrzejL

“Some men just want to watch the world burn.”

Leave a Reply

Your email address will not be published. Required fields are marked *