Pacman

De Banane Atomic
Aller à la navigationAller à la recherche

Installer / Mettre à jour

Bash.svg
# installer un paquet et ses dépendances
pacman -S nom_exact_du_paquet

# mettre à jour l'ensemble du système
pacman -Syu

# installer un groupe sans réinstaller les paquets du groupe déjà installé
sudo pacman -S nom_du_group --needed
/etc/pacman.conf
# ignore packages while update
IgnorePkg = [PackageName]

Désinstaller

Bash.svg
# supprimer un paquet et ses dépendances non-utilisées par d'autres paquets
# et non-installées directement par l'utilisateur
pacman -Rs nom_exact_du_paquet

# supprime en plus les fichiers de configuration
# sinon ces fichiers sont renommés en *.pacsave et réutilisé en cas de réinstallation
pacman -Rns nom_exact_du_paquet

# supprimer un paquet et ses dépendances non-utilisées par d'autres paquets
pacman -Rss nom_exact_du_paquet

# supprimer un paquet, ses dépendances et tous les paquets qui en dépendent
pacman -Rcs nom_exact_du_paquet

# deletes all the cached versions of each package except for the most recent 3
paccache -r
# deletes all the cached versions of each package except for the most recent 2
paccache -rk2

# remove all the cached versions of uninstalled packages
paccache -ruk0

# videz le cache des paquets inutiles. Attention plus de rollback possible des paquets installés après ça.
pacman -Sc

# liste les paquets orphelins qui peuvent être supprimés
pacman -Qdt
# supprimer tous les paquets orphelins
pacman -Rns $(pacman -Qtdq)

Rechercher

Bash.svg
# Recherche parmi les paquets non-installés
pacman -Ss elements de la recherche

# Recherche parmi les paquets installés
pacman -Qs elements de la recherche

# Recherche parmi les paquets étrangers (AUR) installés
pacman -Qm | grep elements de la recherche

# Recherche parmi les paquets natifs (non-AUR) installés explicitement
pacman -Qen | grep elements de la recherche

# explicitly-installed packages
pacman -Qe
# dependency packages
pacman -Qd

# Rechercher le paquet correspondant à un fichier
pacman -F /chemin/fichier.ext
# Mise à jour de la bdd des fichiers
sudo pacman -Fy

Astuces

Bash.svg
# informations d'un paquet
pacman -Qi nom_exact_du_paquet

# change the install reason of the package to explicitly installed
pacman -D --asexplicit nom_exact_du_paquet
# -D permet de modifier la BdD
# --asdeps change the install reason of the package to dependency

# lister les paquets installés par taille
pacman -Qi | awk '/^Nom/ {pkg=$3} /Taille/ {print $4$5,pkg}' | sort -n
pacman -Qi | awk '/^Name/ {pkg=$3} /Installed Size/ {print $4$5,pkg}' | sort -h

# lister les paquets explicitement installés, triés par historique d'installation
pacman -Qei | awk '/^Nom/ {pkg=$3} /^Installé/ {print $5,$6,$7,"- "pkg}' | sort -k 3,3 -k 2M -k 1
pacman -Qei | awk '/^Name/ {pkg=$3} /^Install Date/ {print $5,$6,$7,$8,$9,"- "pkg}' | sort -k 3,3 -k 2,2M -k 1,1 -k 5,5

# lister les paquets explicitement installés et qui ne sont pas dans base ni base-devel
pacman -Qei | awk '/^Name/ { name=$3 } /^Groups/ { if ( $3 != "base" && $3 != "base-devel" ) { print name } }'

# lister les paquets qui ont une dépendance vers le paquet passé en paramètre
pactree -r <pkg_name>
expac -Q '%N' <pkg_name>

Hook

paccache est disponible dans le paquet pacman-contrib
/etc/pacman.d/hooks/clean_cache.hook
[Trigger]
Operation = Upgrade
Type = Package
Target = *

[Action]
Description = Cleaning the pacman cache
When = PostTransaction
Exec = /usr/bin/paccache -r
/etc/pacman.d/hooks/remove_uninstalled_pkg_from_cache.hook
[Trigger]
Operation = Remove
Type = Package
Target = *

[Action]
Description = Remove all the cached versions of uninstalled packages
When = PostTransaction
Exec = /usr/bin/paccache -ruk0

Downgrade

Bash.svg
# installez une version antérieure
pacman -U /var/cache/pacman/pkg/mon_paquet.pkg.tar.xz

Empêcher la mise à jour d'un paquet lors de la mise à jour globale du système

/etc/pacman.conf
IgnorePkg = pcre gimp

Archive des packages

Log

/var/log/pacman.log

PacmanLogViewer

GUI pour visualiser l'historique de l'utilisation de pacman.

Bash.svg
plv

# install
pacman -S pacmanlogviewer

wat

wat reads the log file and only shows things you upgraded.

Bash.svg
# list the upgraded packages in the last full system upgrade
wat
# list the upgraded packages since the full system upgrade 3
wat 3
# list the upgraded packages between the full system upgrade 3 and 2
wat 3 2

# install wat
yay -S wat-git

Configuration des dépôts

/etc/pacman.conf
# Ajout du serveur Archlinuxfr
[archlinuxfr]
SigLevel = Optional TrustedOnly
Server = http://repo.archlinux.fr/$arch

SigLevel

Couleurs

/etc/pacman.conf
# Misc options
Color

Mirrors

/etc/pacman.d/mirrorlist contient la liste des sites contenant la liste des paquets.

Bash.svg
# refresh all package lists, useful when switching from a broken mirror to a working mirror
pacman -Syyu

# refresh all package lists and force downgrade any potentially too-new packages to correspond to the versions offered by the new mirror
pacman -Syyuu

Installer un paquet *.deb

Bash.svg
dpkg -i paquet.deb