alias 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. ##### My (demuredemeanor) bashrc sub source alias script
  2. # Uses tabstop=4; shiftwidth=4 tabs; foldmarker={{{,}}};
  3. # https://notabug.org/demure/dotfiles/
  4. # legacy repo http://github.com/demure/dotfiles
  5. # vim:set syntax=sh:
  6. ### Misc Aliases ### {{{
  7. ## Remove OS X 'junk' files
  8. alias rmds='find . -name ".DS_Store" -depth -exec rm -i {} \;'
  9. alias rmd_='find . -iname '._*' -exec rm -rf {} \;'
  10. ## Show ls -R with readable depth
  11. ## From http://xmodulo.com/useful-bash-aliases-functions.html
  12. alias filetree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'"
  13. ## List programs connected to network
  14. ## From http://xmodulo.com/useful-bash-aliases-functions.html
  15. alias listen="lsof -P -i -n"
  16. ## Make ed more usable, command mode is now ':' like vi
  17. alias ed='ed -p:'
  18. ## Delete duplicate lines from file name augment
  19. alias deldup="awk '!x[$0]++' "
  20. ## Shortcut for wicd-curses
  21. alias wic='wicd-curses'
  22. ### End Misc Aliases ### }}}
  23. ### rsync Aliases ### {{{
  24. ## Old rsync alias
  25. alias rsy='rsync -avrSPXRh'
  26. ## Good for sending dirs from server to remote server
  27. alias rsy1='rsync -avSPRh'
  28. ## This one is for copying off the network shares.
  29. alias rsy2='rsync -rltDvSPRh'
  30. ### End rsync Aliases ### }}}
  31. ### rename utils Aliases ### {{{
  32. if [[ $(command -v qmv) ]]; then
  33. ## Makes qmv more usable, and regex-able
  34. alias qm='qmv --format=destination-only'
  35. fi
  36. ### End rename utils Aliases ### }}}
  37. ### pinfo ### {{{
  38. if [[ $(command -v pinfo) ]]; then
  39. ## Use color pinfo instead of info
  40. alias info='pinfo'
  41. fi
  42. ### End pinfo ### }}}
  43. ### Git Aliases ### {{{
  44. alias git_force_reset='git fetch --all && git reset --hard origin/master'
  45. ### End Git Aliases ### }}}
  46. ### Docker ### {{{
  47. if [[ $(command -v docker) ]]; then
  48. ## find last docker container
  49. alias dl='docker ps -l -q'
  50. fi
  51. ### End Docker ### }}}
  52. ### Vim Aliases ### {{{
  53. if [[ $(command -v vim) ]]; then
  54. ## set vi to call vim
  55. alias vi='vim'
  56. ## Preserve user conf while sudoing vim
  57. alias svi='sudo -E vim'
  58. fi
  59. ### End Vim Aliases ### }}}
  60. ### mpv Aliases ### {{{
  61. if [[ $(command -v mpv) ]]; then
  62. ## set vi to call vim
  63. alias mp='mpv'
  64. alias qmp='tsp mpv'
  65. fi
  66. ### End mpv Aliases ### }}}
  67. ### xclip Aliases ### {{{
  68. if [[ $(command -v xclip) ]]; then
  69. ## make piping to clipboard simple
  70. alias xc="xclip -selection c"
  71. fi
  72. ### End xclip Aliases ### }}}
  73. ### ls Color Test ### {{{
  74. ## Tries home cut down on possible large dirs
  75. ls --color=auto ${HOME} &>/dev/null
  76. if [ ${PIPESTATUS[-1]} == 0 ]; then
  77. alias ls='ls --color=auto'
  78. fi
  79. ### End ls Color Test ### }}}
  80. ### Update All opkg ### {{{
  81. ## Tries home cut down on possible large dirs
  82. ## TODO: move to awk
  83. if [[ $(command -v opkg) ]]; then
  84. ## This is useful on systems like openwrt
  85. alias opkgup="eval \$(opkg list_installed | sed 's/ - .*//' | sed 's/^/opkg upgrade /')"
  86. fi
  87. ### End Update All opkg ### }}}
  88. ### bboard alias ### {{{
  89. if [[ $(command -v bboard) ]]; then
  90. ## lazy alias for sdf's bboard
  91. alias bb='bboard'
  92. fi
  93. ### End board alias ### }}}
  94. ### sudo preserve ENV ### {{{
  95. if [ -e "${HOME}/.config/dotconf/sudo_preserve" ]; then
  96. alias sudo='sudo -E'
  97. fi
  98. ### End sudo preserve ENV ### }}}