http://wiki.archlinux.org/index.php/Off ... tall_Guide
pacman is the package manager which tracks all the software installed on your system. It has simple dependency support and uses the standard gzipped tar archive format for all packages. Some common tasks are explained below with the respective commands in long and short option form. For an up to date explanation of pacman's options, read man pacman. This overview is merely scratching the surface of pacman's current capabilities.
1. Adding a new package with a package file 2. Upgrading a package with a package file 3. Removing packages 4. Refreshing the package list 5. Upgrading the system 6. Adding/Upgrading a package from the repositories 7. List installed packages 8. Check if a specific package is installed 9. Display specific package info 10. Display list of files contained in package 11. Find out which package a specific file belongs to
Adding a new package with a package file
pacman --add foo.pkg.tar.gz
pacman -A foo.pkg.tar.gz
This will install the foo.pkg.tar.gz package on the system. If dependencies are missing, pacman will exit with an error and report the missing deps, but not attempt to resolve the dependencies automatically. Look at the --sync option if you expect this functionality. Adding multiple package files is possible, and if the listed files depend on each other, the packages will be automatically installed in the correct order.
Upgrading a package with a package file
pacman --upgrade foo.pkg.tar.gz
pacman -U foo.pkg.tar.gz
This does essentially the same as the --add operation, but will additionally upgrade an already-installed package at no extra cost. I can personally not imagine a case where you'd prefer --add over this --upgrade function, unless you want pacman to exit if a package is already installed.
pacman --remove foo
pacman -R foo
This will remove all files belonging to the package named foo, except for configuration files that have been edited. Only supply the name of the package to this command, without the pkg.tar.gz suffix.
To remove any and all trace of a package, add the --nosave option to the above command.
Refreshing the package list
pacman --sync --refresh
This will retrieve a fresh master package list from the repositories defined in the /etc/pacman.conf file and uncompress it into the database area. You should use this before using --sysupgrade to make sure you get the newest packages. Depending on your pacman.conf settings, this command may require a working internet connection to access FTP/HTTP-based repositories. This option is quite similar to Debian's apt-get update command.
Upgrading the system
pacman --sync --sysupgrade
This command will upgrade all packages that are out-of-date on your system by comparing the local package version to the versions in the master package list that get downloaded with the --refresh command. It's a good idea to run this regularly to keep your system up to date. Note that this command does NOT implicitly refresh the master package list, so it's usually wiser to combine both commands into one like this:
pacman --sync --refresh --sysupgrade
With these options pacman will automatically retrieve the current master package list and do a full system upgrade to the latest packages with all dependencies being automagically resolved. You will want to run this quite often.
Adding/Upgrading a package from the repositories
pacman --sync foo
pacman -S foo
Retrieve and install package foo, complete with all dependencies it requires. Before using any sync option, make sure you refreshed the package list, or add --refresh or -y to the options to do it before the installation attempt. Unlike --add, the --sync option does not differ between installing and upgrading packages. Depending on your pacman.conf settings this function requires working internet access.
Receiving strange errors when downloading packages from the server, ie. broken downloads or files that aren't found, usually are either caused by not refreshing the package list with --sync, or if you're unlucky enough to try downloading from a mirror while it's syncing its contents, and is thus in an inconsistent state.
List installed packages
Displays a list of all installed packages in the system.
Check if a specific package is installed
pacman --query foo
pacman -Q foo
Instead of grepping the full list for a name, you can append the name of the package you are looking for to the query command. This command will display the name and version of the foo package if it is installed, nothing otherwise.
Display specific package info
pacman --query --info foo
pacman -Qi foo
Displays information on the installed package foo (size, install date, build date, dependencies, conflicts, etc.). To display this information for a package file that is not yet installed, add the --file or -p option, respectively:
pacman --query --info --file foo.pkg.tar.gz
pacman -Qip foo.pkg.tar.gz
Display list of files contained in a package
pacman --query --list foo
pacman -Ql foo
Lists all files belonging to package foo.
Find out which package a specific file belongs to
pacman --query --owns /path/to/file
pacman -Qo /path/to/file
This query displays the name and version of the package which contains the file referenced by it's full path as a parameter. Just using the file name without the path will not yield results.