Videos
Hi yall so I’m using arch Linux since a day I like the way you install packages with command line prompts instead of software store(as a windows user I feel this way boring now) I heard there’s like package manager manager pacman cmds to do so but I installed yay too is it okay? I’m not going with flatpaks and such stuff? Also can some one explain me about AUR and other term i don’t know what it’s called of. I liked that my kde plasma arch didn’t had a browser and I installed it with cmds kinda fun so yeah more tips about cmd/cmds I should known of is helpful and appreciated!!
pacman -Qqen > pkglist.txt
To install:
pacman -S - < pkglist.txt
From ArchWiki: https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks#List_of_installed_packages
I know this is old but I wish to propose a more comprehensive solution.
The way I do it utilises the same idea and proposed in archlinux.org site.
First you need the list of packages, this can be done with
pacman -Qqe > pkglist.txtHere
pacman -Qqueries all installed programs, the-qremoves version numbers and the-eis for listing the explicitly installed programs.Now, when we want to restore/install the programs, I prefer doing
installable_packages=$(comm -12 <(pacman -Slq | sort) <(sort pkglist.txt)) pacman -S --needed $installable_packagesHere we only get the packages from the list are available from pacman. That is done with the
comm -12 file1 file2command. The-12flag suppresses unique lines in file 1 and 2 and leaves us with the intersection of the two files; i.e., the installable packages.
I'm not on linux right now so I can't test it, but this should work...
pacman -S $(cat yourfilename | cut -d' ' -f1)
If that doesn't work, then this should
pacman -S $(echo $(cat yourfilename | cut -d' ' -f1))
The goal here is to give pacman the output of the file as one line, without the version numbering, and each line separated by a space.
Just do:
$ sudo sh -c 'cat input_file | cut "-d " -f1 | xargs pacman -S'
or a simpler version:
$ awk '{print $1}' input_file | xargs pacman -S
or
$ sudo pacman -S $(awk '{print $1}' input_file)
Where input_file contains all your packages to be installed, one to a line.
Word of caution:
As you undoubtedly know, Archlinux is a rolling release package, so specifying version to be installed is not recommended and means you could actually break dependencies and, ultimately, your system overall.
For that reason alone I cut away the version info in your package records in input_file...
If you insists on a rolled back (i.e. "old") version of some package, you can roll back on Arch Linux, but I recommend you do that by hand, not in an automated way, only if you know exactly what you are getting into.
HTH.