Skip to content

Latest commit

 

History

History
57 lines (52 loc) · 1.72 KB

File metadata and controls

57 lines (52 loc) · 1.72 KB

Install

  • Update database: pacman -Sy
  • Update then install pacman -Sy PACKAGE
  • Install pacman -S PACKAGE
  • Silent install pacman -S --noconfirm PACKAGE
    • when --noconfirm not working: echo "y \n" | pacman -S --noconfirm PACKAGE
  • Install from file pacman -U PACKAGE_FILE
  • Download only pacman -Sw PACKAGE
  • System wide upgrade pacman -Syu

Remove

  • Uninstall pacman -R PACKAGE
  • Uninstall with all depends pacman -Rcns PACKAGE
  • Remove outdated package files from cache pacman -Sc

Query

  • Installed:
    • Version pacman -Q PACKAGE
    • Name pacman -Qs PACKAGE (* wildcards allowed)
    • Detail pacman -Qi PACKAGE
    • Own command/file pacman -Qo COMMAND
    • List:
      • All packages pacman -Qqe
      • Files pacman -Ql PACKAGE
  • Search:
    • Contains command/file pacman -F COMMAND
    • Name pacman -Ss PACKAGE (* wildcards allowed)
    • Detail: pacman -Si PACKAGE
      • Depends pacman -Si PACKAGE | awk -F': ' '/^Depends/ {gsub(/ +/, "\n", $2); print $2}'
      • Provides *.so=version *.so=version pacman -Si PACKAGE | grep -E '^Provides|^Version'

Checksum

Verify a package file

read -p 'Package Name: ' PACKAGE
repo=$( pacman -Si $PACKAGE | awk '/^Repo/ {print $NF}' )
file=$( ls /var/cache/pacman/pkg/$PACKAGE-* )
sha_file=$( sha256sum $file | awk '{print $1}' )
sha_db=$( bsdtar xOf /var/lib/pacman/sync/$repo.db \
			| sed -n -e "/^$PACKAGE$/,/^%URL/ p" \
			| sed -n '/^%SHA/ {n;p}' )
if [[ $sha_file == $sha_db ]]; then
	echo -e "\n\e[46m  \e[0m Verified\n"
else
	echo -e "\n\e[41m i \e[0m NOT matched !
$sha_file
$sha_db
"
fi

Recreate package from installed

  • fakepkg PACKAGE

Repositories