1
0

aliases.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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 / podman
  15. if [ -f '/usr/bin/podman' ]; then
  16. alias docker='podman'
  17. alias docker-compose='podman-compose'
  18. fi
  19. alias d='docker'
  20. alias dc='docker compose'
  21. # k8s
  22. alias k='kubectl'
  23. alias kx='kubectx'
  24. # http
  25. alias http-server='python3 -m http.server'
  26. # osx-only aliases
  27. if [[ "$(uname -s)" = 'Darwin' ]]; then
  28. alias get-buffer="$HOME/dotfiles/bin/get-iterm2-buffer"
  29. alias chrome-tabs="$HOME/dotfiles/bin/chrome-tabs"
  30. fi
  31. # node
  32. alias scripts="jq .scripts package.json"
  33. # other bin
  34. alias awsp="$HOME/dotfiles/bin/aws-profile"
  35. # display docker statuses
  36. alias dockerps="docker ps --format 'table {{.Names}}\t{{.Image}}\t{{.Status}}'"
  37. # set terminal title
  38. function title {
  39. echo -ne "\033]0;"$*"\007"
  40. }
  41. alias branchpr="git checkout -b fix/grrowl-\$(date +%s) && gh pr create -w"
  42. # generate password
  43. alias pwgen="openssl rand -base64"
  44. alias rssi="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I | egrep -E 'agrCtlRSSI|agrCtlNoise|lastTxRate'"
  45. # dtach
  46. dtach-job() {
  47. if [ -z $2 ]; then
  48. dtach -a $1.dtach
  49. else
  50. dtach -n $1.dtach /bin/bash -c "${@:2} >> $1.log 2>&1"
  51. fi
  52. }
  53. # better watch
  54. alias watchx="watch -cd -n 2"
  55. # easy checkout
  56. checkout() {
  57. if [ -z "$*" ]; then
  58. echo "Needs arg"
  59. return
  60. fi
  61. DIR=$(echo "$@" | grep -Eo '[^/]+/[^/]+\.git' | sed 's/\.git$//');
  62. git clone "$@" "$HOME/repos/$DIR" || return
  63. cd "$HOME/repos/$DIR" || return
  64. }