Package Management:
Update Package Database:
shell
sudo pacman -Sy
This command synchronizes the local package database with the remote repositories. It should be run before any package installation or upgrades.
Upgrade All Installed Packages:
shell
sudo pacman -Syu
This command updates all installed packages to their latest versions. It also updates the package database.
Search for Packages:
shell
pacman -Ss package_name
Use this command to search for packages in the repositories. Replace
package_name
with the package you want to find.List Installed Packages:
shell
pacman -Q
This lists all installed packages on your system.
Show Information about a Package:
shell
pacman -Qi package_name
This displays detailed information about a specific package, including its version, description, and dependencies.
Remove a Package (and Dependencies not required by other packages):
shell
sudo pacman -R package_name
Use this command to uninstall a package. It will also remove dependencies that are not required by any other installed packages.
Remove a Package (including all dependencies):
shell
sudo pacman -Rs package_name
This command removes the specified package and its dependencies, even if they are required by other installed packages.
Installing Software:
Install a Package:
shell
sudo pacman -S package_name
Use this command to install a package from the official repositories. Replace
package_name
with the name of the package you want to install.Install a Package from the Arch User Repository (AUR):First, you'll need an AUR helper like
yay
ortrizen
. Once you have one installed, you can use it to install packages from the AUR.shell
yay -S package_name
Replace
package_name
with the name of the AUR package you want to install.Install Packages from a Local File:
shell
sudo pacman -U /path/to/packagefile.pkg.tar.xz
Use this command to install packages from local files. Replace
/path/to/packagefile.pkg.tar.xz
with the path to the package file you want to install.Install a Package Group:
shell
sudo pacman -S package-group
Package Maintenance:
Check for Orphaned Packages:
shell
pacman -Qdt
This command lists packages that were installed as dependencies but are no longer required by any installed packages. Be careful when removing these, as they may still be necessary for other software.
Remove Orphaned Packages:
shell
sudo pacman -Rns $(pacman -Qdtq)
This command removes orphaned packages along with their configuration files. Be cautious and review the list of packages before proceeding.
Package Information and Querying:
List Files Provided by a Package:
shell
pacman -Ql package_name
This command displays a list of files installed by a specific package.
Find Which Package Owns a File:
shell
pacman -Qo /path/to/file
Use this command to determine which package owns a particular file on your system.
List Explicitly Installed Packages:
shell
pacman -Qe
This command lists packages that were explicitly installed by the user (not pulled in as dependencies).
Repository Management:
- Add a New Repository:You can manually add new repositories to
/etc/pacman.conf
. Be sure to follow the Arch Linux guidelines for repository additions.
Database and Cache Management:
Clean Package Cache:
shell
sudo pacman -Sc
This command removes old versions of installed packages from the cache to free up disk space. Be cautious, as you won't be able to downgrade packages without these cached versions.
Clean All Cached Files:
shell
sudo pacman -Scc
This command removes all files from the package cache. Use it with caution, as it will make it impossible to downgrade or reinstall packages from the cache.
Refresh Package Database (No Upgrade):
shell
sudo pacman -Sy
Alternative
command line commands for package management and installing software in Arch Linux:
- pacman is the main package manager in Arch Linux. It is used to install, remove, update, and search for packages.
- pacman -S package_name installs the package named
package_name
. - pacman -R package_name removes the package named
package_name
. - pacman -Syu updates all installed packages.
- pacman -Ss package_name searches for packages that match the name
package_name
. - pacman -Q package_name lists all installed packages that match the name
package_name
. - pacman -Qi package_name shows information about the package named
package_name
.
Here are some other commands that you may find useful:
- pacman -Syyuu updates all installed packages, including dependencies.
- pacman -Scc cleans the package cache.
- pacman -F package_name checks the dependencies for the package named
package_name
. - pacman -U file.pkg.tar.gz installs a package from a .pkg.tar.gz file.
You can also use the man pacman
command to get more information about the pacman command.
In addition to the pacman command, there are also a number of AUR helpers that can be used to install packages from the Arch User Repository (AUR). The AUR is a community-maintained repository of packages that are not included in the official Arch Linux repositories.
Some popular AUR helpers include:
- yay
- paru
- pikaur
To use an AUR helper, you first need to install it. Once you have installed an AUR helper, you can use it to install packages from the AUR.
For example, to install the firefox
package from the AUR using the yay helper, you would use the following command:
yay -S firefox
Comments
Post a Comment