archlinux.plugin.zsh 4.1 KB

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