archlinux.plugin.zsh 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # Archlinux zsh aliases and functions for zsh
  2. # Aliases ###################################################################
  3. # Look for yaourt, and add some useful functions if we have it.
  4. if [[ -x `which yaourt` ]]; then
  5. upgrade () {
  6. yaourt -Syu -C
  7. }
  8. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  9. alias yaupg='sudo yaourt -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
  10. alias yain='sudo yaourt -S' # Install specific package(s) from the repositories
  11. alias yains='sudo yaourt -U' # Install specific package not from the repositories but from a file
  12. alias yare='sudo yaourt -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
  13. alias yarem='sudo yaourt -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
  14. alias yarep='yaourt -Si' # Display information about a given package in the repositories
  15. alias yareps='yaourt -Ss' # Search for package(s) in the repositories
  16. alias yaloc='yaourt -Qi' # Display information about a given package in the local database
  17. alias yalocs='yaourt -Qs' # Search for package(s) in the local database
  18. # Additional yaourt alias examples
  19. alias yaupd='sudo yaourt -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  20. alias yainsd='sudo yaourt -S --asdeps' # Install given package(s) as dependencies of another package
  21. alias yamir='sudo yaourt -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  22. else
  23. upgrade() {
  24. sudo pacman -Syu
  25. }
  26. fi
  27. # Pacman - https://wiki.archlinux.org/index.php/Pacman_Tips
  28. alias pacupg='sudo pacman -Syu' # Synchronize with repositories before upgrading packages that are out of date on the local system.
  29. alias pacin='sudo pacman -S' # Install specific package(s) from the repositories
  30. alias pacins='sudo pacman -U' # Install specific package not from the repositories but from a file
  31. alias pacre='sudo pacman -R' # Remove the specified package(s), retaining its configuration(s) and required dependencies
  32. alias pacrem='sudo pacman -Rns' # Remove the specified package(s), its configuration(s) and unneeded dependencies
  33. alias pacrep='pacman -Si' # Display information about a given package in the repositories
  34. alias pacreps='pacman -Ss' # Search for package(s) in the repositories
  35. alias pacloc='pacman -Qi' # Display information about a given package in the local database
  36. alias paclocs='pacman -Qs' # Search for package(s) in the local database
  37. # Additional pacman alias examples
  38. alias pacupd='sudo pacman -Sy && sudo abs' # Update and refresh the local package and ABS databases against repositories
  39. alias pacinsd='sudo pacman -S --asdeps' # Install given package(s) as dependencies of another package
  40. alias pacmir='sudo pacman -Syy' # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist
  41. # https://bbs.archlinux.org/viewtopic.php?id=93683
  42. paclist() {
  43. sudo pacman -Qei $(pacman -Qu|cut -d" " -f 1)|awk ' BEGIN {FS=":"}/^Name/{printf("\033[1;36m%s\033[1;37m", $2)}/^Description/{print $2}'
  44. }
  45. alias paclsorhpans='sudo pacman -Qdt'
  46. alias pacrmorphans='sudo pacman -Rs $(pacman -Qtdq)'
  47. pacdisowned() {
  48. tmp=${TMPDIR-/tmp}/pacman-disowned-$UID-$$
  49. db=$tmp/db
  50. fs=$tmp/fs
  51. mkdir "$tmp"
  52. trap 'rm -rf "$tmp"' EXIT
  53. pacman -Qlq | sort -u > "$db"
  54. find /bin /etc /lib /sbin /usr \
  55. ! -name lost+found \
  56. \( -type d -printf '%p/\n' -o -print \) | sort > "$fs"
  57. comm -23 "$fs" "$db"
  58. }