Remove packages arch linux

How to Remove a Package and Its Dependencies with Pacman on Arch Linux

When you install packages on Arch Linux with Pacman package manager, some other packages are also installed with it. These packages are called the dependencies of the package that you tried to install. It’s all good that Pacman resolves all the dependencies and installs them for you. It saves you from manually installing them one by one, which obviously is boring and time consuming.But the problem comes in when you try to remove the package from your Arch Linux system. By default, Pacman package manager will only remove the package that you tell it to, leaving the dependencies of that package installed. The problem with that is the unnecessary packages takes extra space on the hard drive. Of course that doesn’t matter when you have a big hard drive on your local computer, but if it’s a server that you rented online, you will have limited disk space. So saving a few megabytes to a few hundreds of megabytes is still worth it.

In this article I will show you how to remove packages on Arch Linux along with their dependencies using Pacman package manager. Let’s get started.

Finding Out the Dependencies of a Certain Package

You can use pactree utility to find out the packages the package xyz depends on.

NOTE: You don’t need pactree to remove all the dependencies along with the package. But I find it interesting as it helps you understand how packages on your Arch Linux system are dependent on each other.

Читайте также:  Mount ntfs disk in linux

For example, you can check the dependency of the package filezilla with pactree as follows:

As you can see, pactree shows you a nicely formatted tree of dependencies of filezilla package.

You can pass -d N parameter to pactree to only print a certain depth of the tree. Here N = 1, 2, 3, …

When N=1, the direct dependency tree is printed.

You can run the following command to find out the direct dependencies of filezilla with pactree:

As you can see, the direct dependencies of filezilla is listed.

You can print the list in plain format (not the tree format) with the following command:

If you want, you can export the list to a file, let’s say filezilla.txt with the following command:

Removing a Package and All the Dependencies with Pacman

You can remove only a specific package, let’s say filezilla using Pacman with the following command:

As you can see in the screenshot below, that command would remove the package, but it would leave all the dependencies of filezilla package installed. This is what I was taking about earlier.

Remove Package Dependencies Pacman Arch Linux

You can remove all the dependencies of filezilla as well with the following Pacman command:

As you can see in the screenshot below, all the direct dependencies are going to be removed as well. Just press y and then press to remove all of these packages.

As you can see, all the packages are removed.

Removing Packages that Don’t Depend on Other Packages

If you didn’t know what I showed you earlier, and removed packages with sudo pacman -R command, then your Arch Linux system may have a lot of unnecessary packages still installed. But don’t regret yet. There is a way to remove these unwanted packages and save disk spaces.

You can run the following command to find out all the unnecessary packages (packages that don’t depend on other packages):

Читайте также:  Mount error 112 host is down astra linux

As you can see, on my Arch Linux machine, four unnecessary packages are installed.

If your Arch Linux machine show a longer list, don’t be afraid as you don’t have to remove them one by one.

You can remove all of these unnecessary packages with the following command:

Press y and then press to continue.

As you can see, all the unnecessary packages are removed.

That’s how you remove packages along with its dependencies and remove all the unnecessary packages with Pacman package manager on Arch Linux. Thanks for reading this article.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.

Источник

Pacman Commands Cheat Sheet for Arch Linux

One uniqueness or key identifier of different Linux distributions is in the package manager they use to update, install, configure, and uninstall various targeted software packages. In Arch Linux, the package manager is called Pacman.

This tutorial seeks to walk you through some commonly used and unique Pacman commands that will make your Arch Linux interaction and experience easier and much more memorable.

It is highly advisable to be a root user or have Sudoer user privileges on your Arch Linux system to fully benefit from what the Pacman command has to offer.

Updating and Upgrading Arch Linux

If you only want to update the software database of your Arch Linux system, go with the following command:

Update Arch Linux

To update and upgrade your Arch Linux system, go with the following command:

Upgrade Arch Linux

Install Package(s) in Arch Linux

If you have a specific package called an apache web server in mind that you wish to install, it is advisable to first search for the availability of the package. This step is useful because some Linux OS distributions identify common packages differently.

Читайте также:  Выделить все файлы линукс

Search for Package in Arch Linux

To install an identified package, adhere to the following command:

Supposing you have a local package or one that you have downloaded from a website and wish to install it, you need to adhere to the following command.

$ sudo pacman -U /path/to/your/installable/package

For all repo-based packages re-installation (during emergencies), implement the following command.

$ sudo pacman -Qnq | pacman -S -

Remove Package(s) in Arch Linux

To remove or uninstall a specific Arch Linux installed package, adhere to the following command.

$ sudo pacman -R name_of_package

To remove or uninstall an Arch Linux package together with its dependencies not tied to other active packages, reference the following command syntax:

$ sudo pacman -Rs name_of_package

To uninstall a specific Arch Linux package, remove its global configuration, and avoid its orphaned dependencies, use the following command syntax.

$ sudo pacman -Rns name_of_package

Query Package(s) in Arch Linux

You might wish to retrieve some information about an installed package. The command syntax to use is as follows:

$ pacman -Qi name_of_package

For the apache package we installed earlier, we can get the following info about it:

We can also query about an installable package and its associated dependencies via the command syntax:

$ sudo pacman -Sii name_of_package

To list installed packages, execute the command:

List Installed Packages in Arch Linux

Arch Linux Pacman Cheat Sheet

Following are the list of commonly used commands for the Pacman package manager in Arch Linux.

Command Description
sudo pacman -Syy Update package list
sudo pacman -Syu Update and upgrade all
sudo pacman -S pkgname Install specific package
sudo pacman -Ss keyword Find available packages
sudo pacman -Qs keyword Find available local packages
sudo pacman -Ql pkgname List all files from a package
Sudo pacman -Rsc pkgname Uninstall a package
sudo pacman -Qii pkgname List information on package

With the Pacman command cheat sheet, you should be comfortable enough to take your Arch Linux OS experience to the next level.

Источник

Оцените статью
Adblock
detector