Created
December 6, 2018 14:13
-
-
Save theKAKAN/69bfb34084802c4052880ca64413b3fd to your computer and use it in GitHub Desktop.
Backs up all the installed packages using pacman. Can be used to reinstall them later...
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
#!/bin/bash | |
# A script to back up all the program names. | |
# Can be used to install them again later on | |
TSTAMP=`date +%H:%M_%d-%m-%Y` | |
# Get all the programs available in the repos | |
# And paste them in a file | |
pacman -Qentq > ./native-packages_${TSTAMP}.txt | |
# Get all foreign packages | |
pacman -Qmq > ./foreign-packages_${TSTAMP}.txt | |
# To use it, download the file and execute it | |
# bash ./filename.sh | |
# To use the backed up files, use: | |
# pacman -S $(cat backup-file-name) |
For DNF package manager. This should work well in Fedora and other RHEL distros with DNF installed
# Backup all DNF repos
dnf repoquery --qf '%{name}' --userinstalled \
| grep -v -- '-debuginfo$' \
| grep -v '^\(kernel-modules\|kernel\|kernel-core\|kernel-devel\)$' \
> "$(date) Packages.list"
For Flatpaks
flatpak list -a --columns=application \
| grep -v -- "Application ID$" \
> "$(date) flatpak Packages.list"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Direct command to do it all and create two files in your current directory:
wget -O - https://gist.github.com/theKAKAN/69bfb34084802c4052880ca64413b3fd/raw/3a7f590533fbf62d26784f5f7204db5cb5e193ab/backup-packages-name.sh -nv -q | sh