.aliases 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # All of the color, please
  2. alias ls='ls --color=auto'
  3. alias grep='grep --color=auto'
  4. alias dirs='ls -d */'
  5. if uname -r | grep -q ARCH; then
  6. # Package management
  7. alias update='sudo pacman --color=always -Suy'
  8. alias gimme='update && sudo pacman --color=always -S'
  9. alias drop='sudo pacman --color=always -Rus'
  10. whats() {
  11. pacman --color=always -Ss "$@" | less -R
  12. }
  13. # AUR
  14. aurget() {
  15. pushd
  16. cd ~/aur
  17. if git clone "https://aur.archlinux.org/${1}.git" ; then
  18. echo "Cloned ${1}"
  19. else
  20. cd "$1"
  21. git pull --ff-only
  22. fi
  23. cd "$1"
  24. makepkg && sudo pacman -U "$1"*.tar.xz
  25. popd
  26. }
  27. aurfind() {
  28. local BASE='https://aur.archlinux.org/rpc.php?type=search&arg='
  29. curl "${BASE}$(echo "$@" | sed 's/ /%20/g')" -s \
  30. | jq '.results|.[]|{Name,Description}' \
  31. | sed -e 's/\({\|}\)$//g' \
  32. -e 's/"Name": "\(.*\)",/\1/g' \
  33. -e 's/"Description": "\(.*\)"/: \1/g' \
  34. | fmt
  35. }
  36. else
  37. alias update='sudo apt-get update && sudo apt-get upgrade'
  38. alias gimme='update && sudo apt-get install'
  39. whats() {
  40. apt-cache search "$@" | less
  41. }
  42. drop() {
  43. sudo apt-get remove $@
  44. sudo apt-get autoremove
  45. }
  46. fi
  47. # Clear-screen shortcuts
  48. alias cl='clear'
  49. alias cls='cl;ls'
  50. # Shorter tmux launching
  51. alias attach='tmux attach || tmux'
  52. # Make a password
  53. alias mkpass='apg -m 16 -x 32 -M sncl'
  54. # Serve the current directory
  55. alias serve='python -m http.server'
  56. alias memory_hogs='ps -e -o pid,vsz,comm= | sort -n -k 2 | tail -n12'
  57. # vim: ft=sh