Pacman

From LQWiki
Jump to navigation Jump to search

Installing packages

To install a package or a list of packages (including dependencies), use this command:

# pacman -S package1 package2

There may be multiple versions of a package in different repositories (e.g. extra and testing). To specify which one to install use:

# pacman -S extra/package_name
# pacman -S testing/package_name

Removing packages

To remove a package, leaving all of its dependencies installed:

# pacman -R package_name

To remove a package's dependencies which are not required by any other installed package:

# pacman -Rs package_name

pacman saves important configuration files when removing applications and gives them the .pacsave extention. To delete these files use the -n option:

# pacman -Rn package_name
# pacman -Rns package_name

Upgrading packages

pacman can update all packages and synchronize the repository databases on the system with just one command:

# pacman -Syu

Querying package databases

To query the local package database, use the -Q flag:

$ pacman -Q

and queries the sync databases with the -S flag:

$ pacman -S

pacman can search for packages in the database, searching for both package names and descriptions:

$ pacman -Ss package

To search already installed packages:

$ pacman -Qs package

To show extensive information about a given package:

$ pacman -Si package

for locally installed packages:

$ pacman -Qi package

To show a list of files installed by a package:

$ pacman -Ql package

You can also query the database to show which package a file on the file system belongs to.

$ pacman -Qo /path/to/a/file

To show all packages that are no longer required as dependencies aka orphans:

$ pacman -Qdt