Advertisement
ainx

.bashrc

Jan 28th, 2015
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.38 KB | None | 0 0
  1. #!/bin/bash
  2. #------------------------------------------////
  3. # Lapbox ~/.bashrc file
  4. # Last Modified 20 January 2009
  5. # Running on Debian GNU/Linux - Lenny
  6. #------------------------------------------////
  7. #------------------------------------------////
  8. # Colors:
  9. #------------------------------------------////
  10. black='\e[0;30m'
  11. blue='\e[0;34m'
  12. green='\e[0;32m'
  13. cyan='\e[0;36m'
  14. red='\e[0;31m'
  15. purple='\e[0;35m'
  16. brown='\e[0;33m'
  17. lightgray='\e[0;37m'
  18. darkgray='\e[1;30m'
  19. lightblue='\e[1;34m'
  20. lightgreen='\e[1;32m'
  21. lightcyan='\e[1;36m'
  22. lightred='\e[1;31m'
  23. lightpurple='\e[1;35m'
  24. yellow='\e[1;33m'
  25. white='\e[1;37m'
  26. nc='\e[0m'
  27.  
  28. #------------------------------------------////
  29. # Proxy:
  30. #------------------------------------------////
  31. #http_proxy=http://127.0.0.1:8118/
  32. #HTTP_PROXY=$http_proxy
  33. #export http_proxy HTTP_PROXY
  34.  
  35. #------------------------------------------////
  36. # Aliases:
  37. #------------------------------------------////
  38. ## make ls list by size
  39. ##alias ls='du -s */* | sort -n'
  40. alias findbig='find . -type f -exec ls -s {} \; | sort -n -r | head -5'
  41. alias music='mocp'
  42. alias ports='netstat -nape --inet'
  43. alias ping='ping -c 4'
  44. alias ns='netstat -alnp --protocol=inet'
  45. alias search='aptitude search'
  46. alias show='aptitude show'
  47. alias ls='ls --color=always'
  48. alias la='ls -Al'
  49. alias lx='ls -lXB'
  50. alias lk='ls -lSr'
  51. alias lc='ls -lcr'
  52. alias lu='ls -lur'
  53. alias lr='ls -lR'
  54. alias lt='ls -ltr'
  55. alias lm='ls -al |more'
  56. alias lr='ls -R' # using ls recursively - Handy with grep
  57. alias rlslog='elinks www.rlslog.net' # opens rlslog in terminal
  58.  
  59. # Changing ethernet settings through scripts
  60. alias xbox='sudo sh ~/.config/openbox/xboxscript.sh'
  61. alias stofa='sudo cp /etc/network/stofa /etc/network/interfaces'
  62.  
  63. #alias rm='rm -i'
  64. #------------------------------------------////
  65. # Functions and Scripts:
  66. #------------------------------------------////
  67. localnet ()
  68. {
  69. /sbin/ifconfig | awk /'inet addr/ {print $2}'
  70. echo ""
  71. /sbin/ifconfig | awk /'Bcast/ {print $3}'
  72. echo ""
  73. }
  74. myip ()
  75. {
  76. elinks -dump http://checkip.dyndns.org:8245/ | grep "Current IP Address" | cut -d":" -f2 | cut -d" " -f2
  77. }
  78. upinfo ()
  79. {
  80. echo -ne "${green}$HOSTNAME ${red}uptime is ${cyan} \t ";uptime | awk /'up/ {print $3,$4,$5,$6,$7,$8,$9,$10}'
  81. }
  82. cd()
  83. {
  84.   if [ -n "$1" ]; then
  85.     builtin cd "$@" && ls
  86.   else
  87.     builtin cd ~ && ls
  88.   fi
  89. }
  90. weather ()
  91. {
  92. declare -a WEATHERARRAY
  93. WEATHERARRAY=( `lynx -dump "http://www.google.com/search?hl=en& … tnG=Search" | grep -A 5 -m 1 "Weather for" | sed 's;\[26\]Add to iGoogle\[27\]IMG;;g'`)
  94. echo ${WEATHERARRAY[@]}
  95. }
  96.  
  97. encrypt ()
  98. {
  99. gpg -ac --no-options "$1"
  100. }
  101.  
  102. decrypt ()
  103. {
  104. gpg --no-options "$1"
  105. }
  106.  
  107. extract()
  108. {
  109. if [ -f "$1" ] ; then
  110. case "$1" in
  111. *.tar.bz2) tar xjf "$1" ;;
  112. *.tar.gz) tar xzf "$1" ;;
  113. *.tar.Z) tar xzf "$1" ;;
  114. *.bz2) bunzip2 "$1" ;;
  115. *.rar) unrar x "$1" ;;
  116. *.gz) gunzip "$1" ;;
  117. *.jar) unzip "$1" ;;
  118. *.tar) tar xf "$1" ;;
  119. *.tbz2) tar xjf "$1" ;;
  120. *.tgz) tar xzf "$1" ;;
  121. *.zip) unzip "$1" ;;
  122. *.Z) uncompress "$1" ;;
  123. *) echo "'$1' cannot be extracted." ;;
  124. esac
  125. else
  126. echo "'$1' is not a file."
  127. fi
  128. }
  129. #------------------------------------------////
  130. # Some original .bashrc contents:
  131. #------------------------------------------////
  132. # If not running interactively, don't do anything
  133. [ -z "$PS1" ] && return
  134. # don't put duplicate lines in the history. See bash(1) for more options
  135. export HISTCONTROL=ignoredups
  136. # update the values of LINES and COLUMNS.
  137. shopt -s checkwinsize
  138. # make less more friendly for non-text input files, see lesspipe(1)
  139. [ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
  140. # set variable identifying the chroot you work in (used in the prompt below)
  141. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  142.     debian_chroot=$(cat /etc/debian_chroot)
  143. fi
  144. #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
  145. #------------------------------------------////
  146. # Prompt:
  147. #------------------------------------------////
  148.  
  149. PS1='\[\033[01;32m\]\u\[\033[01;34m\]@\[\033[01;31m\]\h\[\033[00;34m\]{\[\033[01;34m\]\w\[\033[00;34m\]}\[\033[01;32m\]:\[\033[00m\]'
  150.  
  151. #------------------------------------------////
  152. # System Information:
  153. #------------------------------------------////
  154. clear
  155. echo ""
  156. echo -ne "${red}Today is:\t\t${cyan}" `date`; echo ""
  157. echo -e "${red}Kernel Information: \t${cyan}" `uname -smr`
  158. echo -ne "${cyan}";upinfo;echo ""
  159. echo -e "${cyan}"; cal -3
  160. echo ""
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement