Last active
October 20, 2022 10:41
-
-
Save mike-pisman/aadeabc515d4f7925f99b8cda04f1b57 to your computer and use it in GitHub Desktop.
A few command to help migrate from old Ubuntu/Debian machine to a new one and reinstall all of the aptitude packages.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# On the old machine, create a list of all installed packages | |
apt list --installed 2>/dev/null | sed 's/\/.*//g > pkglist' | |
# On the new machine, Filter packages for those available | |
while read package; do apt show "$package" 2>/dev/null | grep -qvz 'State:.*(virtual)' && echo "$package" >>packages-valid && echo -ne "\r\033[K$package"; done <packages | |
# Install the available packages all at once | |
sudo apt install $(tr '\n' ' ' <packages-valid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment