CONTENT
Install packages
Install a single package or multiple packages using pacman command in this fashion:
sudo pacman -S package1 package2 ...
The -S
stands for synchronization. It means that pacman first synchronizes
Install local or third-party packages
Install a ‘local’ package that is not from a remote repository:
sudo pacman -U /path/to/package/package-version.pkg.tar.xz
Install a ‘remote’ package, not contained in an official repository:
sudo pacman -U http://www.example.com/repo/example.pkg.tar.xz
Remove packages
To remove a single package, leaving all of its dependencies installed:
sudo pacman -R package
To remove a package and its dependencies which are not required by any other installed package:
sudo pacman -Rs package
To remove dependencies that are no longer needed. For example, the package which needed the dependencies was removed.
pacman -Qdtq | pacman -Rs -
Upgrade packages (full system update)
You can update all installed packages with just one command that synchronizes the repository databases and updates the system’s packages, excluding “local” packages that are not in the configured repositories:
sudo pacman -Syu
- S = sync
- y = refresh (local cache)
- u = system update
Upgrade packages and force resfresh database (full system update)
Update all installed packages and force a refresh of all package databases, even if they appear to be up-to-date:
sudo pacman -Syyu
Check for upgrades (no install)
Query the package database for packages that are out-of-date on the local system:
sudo pacman -Qu
Search packages
Pacman can search for packages in the database, both in packages’ names and descriptions:
pacman -Ss package
To search for already installed packages:
pacman -Qs package1 package2 ...
To search for package file names in remote packages:
pacman -F package1 package2 ...
To view the dependency tree of a package:
pactree package
Clean package cache
Pacman stores its downloaded packages in /var/cache/pacman/pkg/ and does not remove the old or uninstalled versions automatically. It is necessary to clean up the cache periodically to prevent the folder to grow in size.
paccache -r
To remove all the cached packages that are not currently installed, and the unused sync database:
sudo pacman -Sc
To remove all files from the cache, use the clean switch twice, this is the most aggressive approach and will leave nothing in the cache folder:
sudo pacman -Scc
source: It's FOSS