Forrest logo
back to the pacman tool

pacman-remove:tldr:a1932

pacman-remove: Remove orphan packages (installed as dependencies but not required by any package).
$ sudo pacman --remove --recursive --nosave $(pacman --query --unrequired --deps --quiet)
try on your machine

This command will uninstall any packages on an Arch Linux system that are no longer required by any other installed packages.

Let's break it down:

  • sudo: It runs the following command with superuser privileges, allowing it to modify system files and settings.

  • pacman: This is the package manager for Arch Linux.

  • --remove: This is a parameter for pacman that specifies that the package(s) should be removed.

  • --recursive: This is another parameter for pacman that specifies that the operation should be performed recursively. It means that any dependent packages that become no longer required after the removal will also be uninstalled.

  • --nosave: This is yet another parameter for pacman that specifies that the removed packages should not be added to the package backup list. It means that you won't be able to easily reinstall them later using the pacman -S command.

  • $(pacman --query --unrequired --deps --quiet): This is command substitution. It runs the inner command pacman --query --unrequired --deps --quiet, which lists the packages that are no longer required by any other installed packages. The output of this command is then passed as arguments to the sudo pacman --remove --recursive --nosave command.

So in summary, the command will uninstall any packages that are no longer required, along with their dependencies, without saving them for future reinstallation.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the pacman tool