Skip to content

Instantly share code, notes, and snippets.

@rafael-neri
Last active December 11, 2023 18:03
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rafael-neri/dc1a979acfaf2b5aadaf6a7a2bde54ba to your computer and use it in GitHub Desktop.
Save rafael-neri/dc1a979acfaf2b5aadaf6a7a2bde54ba to your computer and use it in GitHub Desktop.
Reinstall All packages in Linux Arch Based
#!/bin/bash
pacman -Q | awk '{ print $1 }' | sort > /tmp/pacman-installed.tmp
pacman -Qm | awk '{ print $1 }' | sort | comm -3 /tmp/pacman-installed.tmp - > /tmp/pacman-to-reinstall.tmp
pacman -S --noconfirm $(cat /tmp/pacman-to-reinstall.tmp)
rm /tmp/pacman-{to-reinstall,installed}.tmp
@luntik2012
Copy link

bad idea, it will mark all packages as explicitly installed. try with --asdeps

@rafael-neri
Copy link
Author

@luntik2012: Thanks. I'll try to use your suggestion next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment