10_alias.zsh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. #
  2. # Editor
  3. #
  4. export EDITOR="vim"
  5. #
  6. # Pager
  7. #
  8. if (( $+commands[vim] )) && [[ -f ~/.vim/bin/vimpager ]]; then
  9. export PAGER=~/.vim/bin/vimpager
  10. alias less="$PAGER"
  11. alias more="$PAGER"
  12. elif (( $+commands[less] )); then
  13. export PAGER=less
  14. alias more="$PAGER"
  15. elif (( $+commands[more] )); then
  16. export PAGER=more
  17. fi
  18. export GIT_PAGER="$PAGER"
  19. #
  20. # Common aliases / functions
  21. #
  22. alias l='ls -lsh'
  23. alias rm='rm -i'
  24. alias mv='mv -i'
  25. alias cp='cp -i'
  26. alias vlock='clear;vlock'
  27. alias q='clear;exit'
  28. export GREP_OPTIONS="--color=auto"
  29. alias mgrep="grep -rnisH"
  30. alias rsu="sudo -E zsh"
  31. alias reloadsh="exec zsh"
  32. alias tmux="tmux -2"
  33. alias md="mkdir -p"
  34. mcd() { mkdir -p "$@" && cd "$@" }
  35. ffi() {
  36. find -iname "$@"
  37. }
  38. #
  39. # Log viewers aliases
  40. #
  41. if (( $+commands[ccze] )); then
  42. alias alog="tail -n 300 -F /var/log/auth.log | ccze"
  43. alias mlog="tail -n 300 -F /var/log/mail.log | ccze"
  44. alias slog="tail -n 300 -F /var/log/syslog | ccze"
  45. alias xlog="tail -n 300 -F /var/log/Xorg.0.log | ccze"
  46. else
  47. alias alog="tail -n 300 -F /var/log/auth.log"
  48. alias mlog="tail -n 300 -F /var/log/mail.log"
  49. alias slog="tail -n 300 -F /var/log/syslog"
  50. alias xlog="tail -n 300 -F /var/log/Xorg.0.log"
  51. fi
  52. # using colortail if available (freebsd)
  53. if (( $+commands[colortail] )); then
  54. alias slog="colortail -n 60 -k /usr/local/share/examples/colortail/conf.messages -f /var/log/syslog"
  55. fi
  56. #
  57. # System tools aliases
  58. #
  59. alias df='df -h'
  60. if (( $+commands[pydf] )); then
  61. alias df="pydf -h"
  62. fi
  63. function mount() {
  64. if [ $# = 0 ]; then
  65. command mount -lv | column -t
  66. else
  67. command mount $@
  68. fi
  69. }
  70. #
  71. # Sysadmin stuff
  72. #
  73. if (( $+commands[dig] )); then
  74. alias mx="dig +short MX"
  75. alias ns="dig +short NS"
  76. elif (( $+commands[host] )); then
  77. alias mx="host -t MX"
  78. alias ns="host -t NS"
  79. fi
  80. alias scp_nosec="scp -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null'"
  81. alias ssh_nosec="ssh -o 'StrictHostKeyChecking=no' -o 'UserKnownHostsFile=/dev/null'"
  82. # OpenSSL
  83. for i in sha512 sha256 sha1 md5 ; do
  84. ssl-cert-$i() {
  85. openssl x509 -noout -fingerprint -$i -in $1
  86. }
  87. done
  88. ssl-cert-fingerprints() {
  89. for i in sha512 sha256 sha1 md5; do
  90. ssl-cert-$i $1
  91. done
  92. }
  93. ssl-cert-info() {
  94. openssl x509 -noout -text -in $1
  95. ssl-cert-fingerprints $1
  96. }
  97. #
  98. # Devel tools aliases
  99. #
  100. if (( $+commands[colormake] )); then
  101. alias make="colormake"
  102. fi
  103. #
  104. # Mssh stuff
  105. #
  106. if [ -f ~/.ssh/config ]; then
  107. hosts=($(grep '^Host [^*]' ~/.ssh/config | sed 's/Host //'))
  108. compctl -k hosts mssh
  109. fi