Skip to content

Instantly share code, notes, and snippets.

@theKAKAN
Created December 6, 2018 14:13
Show Gist options
  • Save theKAKAN/69bfb34084802c4052880ca64413b3fd to your computer and use it in GitHub Desktop.
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...
#!/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)
@theKAKAN
Copy link
Author

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