How to install and remove a package group in Arch Linux

If you want to try out larger softwares that have multiple dependencies and then remove them without hassle and manual labor, here’s how to install and remove a group of packages in Arch Linux.

The pacman package manager is one of the great advantages of Arch Linux as it combines a simple binary package format with an easy-to-use build system.

How to install and remove a package group in Arch Linux
How to install and remove a package group in Arch Linux

The main goal of pacman is to make it as easy as possible to manage packages, whether they be from official repositories or from the user’s own compilations.

To achieve this, Pacman has many useful features compared to other package managers to get things done easily.

For example, if you want to test Deepin DE on Arch Linux. The problem with this software is when you need to remove it after testing it, you will have to manually mark the parts you want to keep in Arch Linux. It is time consuming and very annoying.

Fortunately, someone on Reddit asked about this situation and got the right solution: an easy and reliable way to install and remove a package group without affecting existing packages.

How to install and remove a package group in Arch Linux

Step 1. Open a terminal; 
Step 2. Create a list of packages that belong to the package group that you want to install using the following command. This command will add all packages belonging to the deepin package group to a file named “install.txt” in your current directory. Note that it will simply add the package names to the file, it will not install them;

pacman -Sp deepin --print-format '%n' --needed > install.txt

Step 3. Next, install the package group as usual;

sudo pacman -S deepin

Step 4. When you want to remove the packet group, simply use pacman that way. This command will remove only the packages mentioned in the install.txt file;

sudo pacman -R - < install.txt

And it’s ready! Did you like the solution? Leave your opinion in the comments.

For more details on using Pacman, see the man pages of the software:

man pacman

Leave a Reply

Your email address will not be published. Required fields are marked *