Manjaro/Arch: transfer packages to another computer
So you’ve finally set up your computer to your liking, and organized and backed up all your dotfiles. If you want to save a list of all the software you’ve installed, you can use this simple pacman
trick.
Pacman is a package management utility that tracks installed packages on a Linux system. It features dependency support, package groups, install and uninstall scripts, and the ability to sync your local machine with a remote repository to automatically upgrade packages. Pacman packages are a zipped tar format.
In order to save all installed packages, execute the following:
pacman -Qqe > .config/packages.txt
I’m putting the output into packages.txt
in my .config
folder, as this is a git repo that’s backed up to Github. The -Qqe
options makes a neat list.
-Q
: Query the package database. This operation allows you to view installed packages and their files, as well as meta-information about individual packages (dependencies, conflicts, install date, build date, size). This can be run against the local package database or can be used on individual package files. In the first case, if no package names are provided in the command line, all installed packages will be queried. Additionally, various filters can be applied on the package list.-q
: Show less information for certain query operations. This is useful when pacman’s output is processed in a script. Search will only show package names and not version, group, and description information; owns will only show package names instead of “file is owned by pkg” messages; group will only show package names and omit group names; list will only show files and omit package names; check will only show pairs of package names and missing files; a bare query will only show package names rather than names and versions.-e
: Restrict or filter output to explicitly installed packages. This option can be combined with -t to list explicitly installed packages that are not required by any other package.
Now in order to install all these packages on your other machine, execute the following:
sudo pacman -S - < .config/packages.txt
The -S
flag synchronizes (installs) all packages listed in the packages.txt
file.
Recent Posts
Extend ActiveStorage::Blob with callbacks
ActiveStorage is currently missing both validations and callbacks, but you can easily extend it with the callbacks you need.
Writing a custom analyzer for ActiveStorage
Writing custom analyzers for your ActiveStorage blogs is not well documented, but quite easy. This is how I implemented a simple EDI file analyzer for my neverending hobby project.
Getting Norwegian characters on a US keyboard in Linux
Using a aluminum Apple keyboard in Linux, and getting accessible Norwegian characters like MacOS.