aliases.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #!/bin/bash
  2. # ls
  3. alias l='ls -lFh' # size,show type,human readable
  4. alias la='ls -lAFh' # long list,show almost all,show type,human readable
  5. alias lr='ls -tRFh' # sorted by date,recursive,show type,human readable
  6. alias lt='ls -ltFh' # long list,sorted by date,show type,human readable
  7. alias ll='ls -l' # long list
  8. alias lth='lt | head -16' # latest 15
  9. alias dfh='df -h' # df
  10. # du
  11. alias duh="du -sh * | sort -h"
  12. # export local .env file
  13. alias export-env="export \$(grep -v '^#' .env | xargs -0)"
  14. # docker
  15. alias docker='podman'
  16. alias docker-compose='podman-compose'
  17. alias d='docker'
  18. alias dc='docker compose'
  19. # k8s
  20. alias k='kubectl'
  21. alias kx='kubectx'
  22. # http
  23. alias http-server='python3 -m http.server'
  24. # osx-only aliases
  25. if [[ "$(uname -s)" = 'Darwin' ]]; then
  26. alias get-buffer="$HOME/dotfiles/bin/get-iterm2-buffer"
  27. alias chrome-tabs="$HOME/dotfiles/bin/chrome-tabs"
  28. fi
  29. # node
  30. alias scripts="jq .scripts package.json"
  31. # other bin
  32. alias awsp="$HOME/dotfiles/bin/aws-profile"
  33. # display docker statuses
  34. alias dockerps="docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'"
  35. # set terminal title
  36. function title {
  37. echo -ne "\033]0;"$*"\007"
  38. }
  39. alias branchpr="git checkout -b fix/grrowl-\$(date +%s) && gh pr create -w"
  40. # generate password
  41. alias pwgen="openssl rand -base64"
  42. alias rssi="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | egrep -E 'agrCtlRSSI|agrCtlNoise|lastTxRate'"
  43. # dtach
  44. dtach-job() {
  45. if [ -z $2 ]; then
  46. dtach -a $1.dtach
  47. else
  48. dtach -n $1.dtach /bin/bash -c "${@:2} >> $1.log 2>&1"
  49. fi
  50. }
  51. # better watch
  52. alias watchx="watch -cd -n 2"
  53. # easy checkout
  54. checkout() {
  55. if [ -z "$*" ]; then
  56. echo "Needs arg"
  57. return
  58. fi
  59. DIR=$(echo "$@" | grep -Eo '[^/]+/[^/]+\.git' | sed 's/\.git$//');
  60. git clone "$@" "$HOME/repos/$DIR" || return
  61. cd "$HOME/repos/$DIR" || return
  62. }