Advertisement
Guest User

Untitled

a guest
Dec 25th, 2013
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.20 KB | None | 0 0
  1. # EM
  2.  
  3. alias s="ssh"
  4. alias r="rm -rf"
  5. alias t='top'
  6. alias u='uname -a; w'
  7. alias v='vim'
  8. alias e='exit'
  9. alias ex='exit'
  10. alias nv_on="echo ON > /sys/kernel/debug/vgaswitcheroo/switch"
  11. alias nv_of="echo OFF > /sys/kernel/debug/vgaswitcheroo/switch"
  12. alias hh='history'
  13. alias ll='ls -alhF'
  14. alias lh='ls -lh'
  15. alias c-='c -'
  16. alias c..='c ../'
  17. alias c...='c ../../'
  18. alias c....='c ../../../'
  19. alias c.....='c ../../../../'
  20. alias c~='c ~'
  21. alias cx='chmod +x'
  22. alias pu='pushd .'
  23. alias po='popd'
  24. alias go='gnome-open'
  25. alias glog='git log --pretty=format:"%h - %an, %ar : %s" --graph'
  26. alias gl="git log --graph --pretty=format:'%Cblue%h%Creset -%C(bold blue)%d%Creset %C(yellow)%s %Cred(%cr) %C(white)<%an>%Creset' --abbrev-commit"
  27. # alias lh="ll | awk -F " " '{print $5 "\t" $9}'"
  28. alias gp="git pull --rebase"
  29. # Add support to permalias
  30. # http://stackoverflow.com/questions/15235141/how-to-create-a-function-in-bashrc-that-will-work-correctly-when-the-command-ru
  31. #
  32.  
  33. #
  34. # Usage exc - <file1> <file2>
  35. #
  36.  
  37. function exc() {
  38. mv $1 temp31337;
  39. mv $2 $1;
  40. mv temp31337 $2;
  41. }
  42.  
  43. #
  44. # Usage: h - htop
  45. # h <string> - history | grep string
  46. #
  47.  
  48. function h() {
  49. case "$#" in
  50. 0) htop
  51. ;;
  52. 1) history | grep $1
  53. ;;
  54. *) echo "Undefined"
  55. ;;
  56. esac
  57. }
  58.  
  59. # p
  60. # Usage: p - ps;
  61. # p <proces> - ps aux | grep proces
  62. # p ip/host - ping ip/host
  63.  
  64. function p() {
  65. case "$#" in
  66. 0) ps
  67. ;;
  68. 1) if [[ $1 =~ [0-9]+\.[0-9]+\.[0-9]+\.[0-9]+ || $1 =~ [a-z]+\.("com"|"net"|"org"|"ro") ]]
  69. then
  70. ping $1;
  71. else
  72. ps aux | head -1 && ps aux | grep $1;
  73. fi
  74. ;;
  75. *) echo "Undefined"
  76. ;;
  77. esac
  78. }
  79.  
  80. # Usage c - clear; c <sursa> <destinatie>
  81.  
  82. function c() {
  83. case "$#" in
  84. 0)
  85. if [[ `history | tail -2 | head -1 | awk '{ print $2 $3 }'` = "c" ]]; then
  86. cd;
  87. else
  88. clear;
  89. fi
  90. ;;
  91. 1) if [[ $1 = "-" ]]; then
  92. cd -;
  93. elif [[ -f $1 ]]; then
  94. cat $1;
  95. elif [[ -d $1 ]]; then
  96. cd $1 && ls;
  97. else
  98. echo "Invalid arg"
  99. fi
  100. ;;
  101. 2) cp -vr $1 $2;
  102. ;;
  103. *) echo "Undefined"
  104. ;;
  105. esac
  106. }
  107.  
  108. # Usage: m = make; m <sursa> <dest>
  109.  
  110. function m() {
  111. case "$#" in
  112. 0) make
  113. ;;
  114. 1) mkdir $1 && cd $1;
  115. ;;
  116. 2) mv -v $1 $2
  117. ;;
  118. *) echo "Undefined"
  119. ;;
  120. esac
  121. }
  122.  
  123. # Usage: arc folder <type>
  124. # type = zip/tar/tar.bz/bz2
  125. function arc() {
  126. # TODO
  127. false;
  128. }
  129.  
  130.  
  131. # Usage: ext archiva.<tar.bz2/tar.gz/bz2/rar/gz>
  132.  
  133. function ext() {
  134. if [ -f $1 ] ; then
  135. case $1 in
  136. *.tar.bz2) tar xvjf $1
  137. ;;
  138. *.tar.gz) tar xvzf $1
  139. ;;
  140. *.bz2) bunzip2 $1
  141. ;;
  142. *.rar) unrar x $1
  143. ;;
  144. *.gz) gunzip $1
  145. ;;
  146. *.tar) tar xvf $1
  147. ;;
  148. *.tbz2) tar xvjf $1
  149. ;;
  150. *.tgz) tar xvzf $1
  151. ;;
  152. *.zip) unzip $1
  153. ;;
  154. *.Z) uncompress $1
  155. ;;
  156. *.7z) 7z x $1
  157. ;;
  158. *) echo "'$1' Undefined "
  159. ;;
  160. esac
  161. else
  162. echo "'$1' is not a valid file"
  163. fi
  164. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement