pacman

Using pacapt universal package manager (pacman for all)

pacapt is a shell script that wraps native package managers in a pacman@arch syntax. Intended for Arch users having to temporarily deal with another distribution.

It supports pacman by arch, dpkg/apt-get by debian/ubuntu, homebrew by OSX, yum/rpm by redhat/centos/fedora, portage by gentoo, zypper by opensuse, pkgng by freebsd, pkg_tools by openbsd. See pacman_rosetta@arch

## install
$ wget -O /usr/local/bin/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
$ chmod 755 /usr/local/bin/pacapt

'-Q' list packages installed
'-Qq FILE' query which package provides file
'-Ql PACKAGE' list package files
'-S PACKAGE' install package
'-Ss PACKAGE' search package
'-Suy' upgrade system and package db
'-R PACKAGE' remove package
'-Scc' delete all downloaded packages

Using Arch Linux’s pacman/ABS/AUR

  • pacman combines a simple binary package format with an easy-to-use build system. Written in the C programming language and uses the .pkg.tar.xz package format.
# update package databases
$ pacman -Sy

# search all package, or just installed
$ pacman -Ss <package> or pacman -Qs <package>
(add color, either use 'pacsearch <package>' a perl wrapper for 'pacman -Ss' or)
$ nano /etc/pacman.conf
Color

# query all package info, or just installed package info
$ pacman -Si <package> or pacman -Qi <package>
# lists all files associated with a package
$ pacman -Ql <package>
# list package disk usage
$ pacsysclean

# download/install
$ sudo pacman -S <package>
# just download
$ sudo pacman -Sw <package>
# install locally, used in AUR
$ sudo pacman -U <package_path>

# list packages out of date
$ pacman -Qu
# install packages out of date
$ sudo pacman -Syu

# list downloaded packages
$ ls /var/cache/pacman/pkg | grep <package>
# revert to a package in your cache
$ pacman -U <path_to_cached_file>
# rollback using https://wiki.archlinux.org/index.php/Arch_Rollback_Machine
$ pacman -U http://seblu.net/a/arm/2013/08/31/extra/os/x86_64/apache-2.2.25-1-x86_64.pkg.tar.xz
# same using downgrade/downgrader
$ downgrade <package> | downgrader <package>

# remove a package, leaves dependencies
$ sudo pacman -R <package>
# remove packages and orphan dependencies
$ sudo pacman -Rs <package>

# mirrors by speed, see https://wiki.archlinux.org/index.php/Mirrors
$ sudo cp /etc/pacman.d/mirrorlist{,.backup}
$ sudo rankmirrors -n 6 /etc/pacman.d/mirrorlist.backup > /etc/pacman.d/mirrorlist
$ sudo pacman -Syy

# pacman frontends, https://wiki.archlinux.org/index.php/Pacman_GUI_Frontends
# note: if using putty change translation to latin1
$ sudo pacman -S pcurses 
$ yaourt yaourt-gui

# tips, see https://wiki.archlinux.org/index.php/Pacman_tips and https://wiki.archlinux.org/index.php/System_maintenance
# remove orphan packages
$ pacman -Rns $(pacman -Qtdq)
# reinstall all packages (except foreign)
# pacman -Qenq | pacman -S -
# remove all the cached packages not installed
$ sudo pacman -Sc

from howto use arch package management

While pacman is the specialized Arch tool for binary package management (including packages built with the ABS), ABS is a collection of tools for compiling source into installable .pkg.tar.xz packages.

ABS is not necessary to use Arch Linux, but it is useful for automating certain tasks of source compilation.

$ sudo pacman -S abs ; sudo abs
$ mkdir -p ~/abs ; cp /var/abs// ~/abs
$ $ cd ~/abs/ ; makepkg -s ; sudo pacman *.tar.xz 

It contains package descriptions PKGBUILDs that allow you to compile a package from source with makepkg and then install it via pacman.

# prerequisites
$ sudo pacman -S --needed base-devel

# manually 
$ mkdir ~/build ; cd $_
$ curl https://aur.archlinux.org/packages///.tar.gz | tar xvf
$ cd  ; makepkg -s ; pacman -U *.tar.xz ; cd -
# list foreign packages
$ pacman -Qm 

# using https://wiki.archlinux.org/index.php/Yaourt as a https://wiki.archlinux.org/index.php/AUR_Helpers
$ mkdir ~/build ; cd $_
$ curl https://aur.archlinux.org/packages/pa/package-query/package-query.tar.gz | tar xvf
$ cd package-query ; makepkg -si ; cd -
$ curl https://aur.archlinux.org/packages/ya/yaourt/yaourt.tar.gz | tar xvf
$ cd yaourt ; makepkg -si ; cd -

# install package
$ yaourt  or yaourt -Sa 
# sync database, upgrade packages, search aur and devel upgrades
$ yaourt -Syu --devel --aur
# build package from source
$ yaourt -Sb 

from yaourt