archlinux.plugin.zsh 4.0 KB

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