I am trying to move from one arch install a (partitioned one) to another (a less-partitioned one) on my computer and I want a similar set up. So I was wondering if there was a simple way to get pacman to install the same packages.

I was thinking of something like pacman -Qe | awk '{print $1}' > package_list.txt then creating a script to install from that list.

Is there a way I can create that script in a few commands or how should I go about doing this?


2 Answers 2


You can use pacman -Qeq instead of pacman -Qe | awk '{print $1}'. And pacman can not install AUR packages, better keep them in a separate list or use an AUR helper like pacaur or yaourt.

So, if you use an AUR helper like pacaur, you can export all explicitly installed packages with:

pacman -Qqe > package_list.txt

Or if you prefer only native and explicitly installed packages:

pacman -Qqen > package_list.txt

To install the packages listed in the file:

pacman -S - < package_list.txt

Replace pacman with pacaur or your AUR helper if needed.


I recently reinstalled arch linux several times, tried using some -Qqe options with pacman, but came across several issues with locally installed packages and such, that I had to comment/remove manually. For me what's worked best is following what the arch wiki says in: https://wiki.archlinux.org/title/migrate_installation_to_new_hardware#Bottom_to_top

Generating the package list in an old system:

pacman -Qqen > pkglist.txt
pacman -Qqem > pkglist_aur.txt

Then (substitute yay for whichever your AUR helper is) on the new system:

pacman -S --needed - < pkglist.txt
yay -S --needed - < pkglist_aur.txt

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .