Backup/Restore pacman & yaourt packages list

Arch linux

Backup pacman package list

pacman -Qqet | grep -v "$(pacman -Qqg base)" | grep -v "$(pacman -Qqm)" > pacman-packages.txt

 

Restore pacman package 

pacman -S --needed $(cat pacman-packages.txt)

 

Backup yaourt package list

pacman -Qm > yaourt-packages.txt

 

Backup yaourt package

yaourt -S --needed --noconfirm $(cat yaourt-packages.txt)