common-aliases.plugin.zsh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. # Advanced Aliases.
  2. # Use with caution
  3. #
  4. # ls, the common ones I use a lot shortened for rapid fire usage
  5. alias l='ls -lFh' #size,show type,human readable
  6. alias la='ls -lAFh' #long list,show almost all,show type,human readable
  7. alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
  8. alias lt='ls -ltFh' #long list,sorted by date,show type,human readable
  9. alias ll='ls -l' #long list
  10. alias ldot='ls -ld .*'
  11. alias lS='ls -1FSsh'
  12. alias lart='ls -1Fcart'
  13. alias lrt='ls -1Fcrt'
  14. alias zshrc='vim ~/.zshrc' # Quick access to the ~/.zshrc file
  15. alias grep='grep --color'
  16. alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS} '
  17. alias t='tail -f'
  18. # because typing 'cd' is A LOT of work!!
  19. alias ..='cd ../'
  20. alias ...='cd ../../'
  21. alias ....='cd ../../../'
  22. alias .....='cd ../../../../'
  23. # Command line head / tail shortcuts
  24. alias -g H='| head'
  25. alias -g T='| tail'
  26. alias -g G='| grep'
  27. alias -g L="| less"
  28. alias -g M="| most"
  29. alias -g LL="2>&1 | less"
  30. alias -g CA="2>&1 | cat -A"
  31. alias -g NE="2> /dev/null"
  32. alias -g NUL="> /dev/null 2>&1"
  33. alias -g P="2>&1| pygmentize -l pytb"
  34. alias dud='du -d 1 -h'
  35. alias duf='du -sh *'
  36. alias fd='find . -type d -name'
  37. alias ff='find . -type f -name'
  38. alias h='history'
  39. alias hgrep="fc -El 0 | grep"
  40. alias help='man'
  41. alias j='jobs'
  42. alias p='ps -f'
  43. alias sortnr='sort -n -r'
  44. alias unexport='unset'
  45. alias whereami=display_info
  46. alias rm='rm -i'
  47. alias cp='cp -i'
  48. alias mv='mv -i'
  49. # zsh is able to auto-do some kungfoo
  50. # depends on the SUFFIX :)
  51. if [ ${ZSH_VERSION//\./} -ge 420 ]; then
  52. # open browser on urls
  53. _browser_fts=(htm html de org net com at cx nl se dk dk php)
  54. for ft in $_browser_fts ; do alias -s $ft=$BROWSER ; done
  55. _editor_fts=(cpp cxx cc c hh h inl asc txt TXT tex)
  56. for ft in $_editor_fts ; do alias -s $ft=$EDITOR ; done
  57. _image_fts=(jpg jpeg png gif mng tiff tif xpm)
  58. for ft in $_image_fts ; do alias -s $ft=$XIVIEWER; done
  59. _media_fts=(ape avi flv mkv mov mp3 mpeg mpg ogg ogm rm wav webm)
  60. for ft in $_media_fts ; do alias -s $ft=mplayer ; done
  61. #read documents
  62. alias -s pdf=acroread
  63. alias -s ps=gv
  64. alias -s dvi=xdvi
  65. alias -s chm=xchm
  66. alias -s djvu=djview
  67. #list whats inside packed file
  68. alias -s zip="unzip -l"
  69. alias -s rar="unrar l"
  70. alias -s tar="tar tf"
  71. alias -s tar.gz="echo "
  72. alias -s ace="unace l"
  73. fi
  74. # Make zsh know about hosts already accessed by SSH
  75. zstyle -e ':completion:*:(ssh|scp|sftp|rsh|rsync):hosts' hosts 'reply=(${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ })'