SHARE
TWEET

bash color config 1

thunderbirdtr Nov 22nd, 2011 75 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ################################
  2. ### Colors ###
  3. ################################
  4.  
  5. BLACK='\e[0;30m'
  6. BLUE='\e[0;34m'
  7. GREEN='\e[0;32m'
  8. CYAN='\e[0;36m'
  9. RED='\e[0;31m'
  10. PURPLE='\e[0;35m'
  11. BROWN='\e[0;33m'
  12. LIGHTGRAY='\e[0;37m'
  13. DARKGRAY='\e[1;30m'
  14. LIGHTBLUE='\e[1;34m'
  15. LIGHTGREEN='\e[1;32m'
  16. LIGHTCYAN='\e[1;36m'
  17. LIGHTRED='\e[1;31m'
  18. LIGHTPURPLE='\e[1;35m'
  19. YELLOW='\e[1;33m'
  20. LIGHTYELLOW='\e[0;33m'
  21. WHITE='\e[1;37m'
  22. NC='\e[0m' # No Color
  23.  
  24.  
  25. # Less Colors for Man Pages
  26. export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking
  27. export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold
  28. export LESS_TERMCAP_me=$'\E[0m' # end mode
  29. export LESS_TERMCAP_se=$'\E[0m' # end standout-mode
  30. export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box
  31. export LESS_TERMCAP_ue=$'\E[0m' # end underline
  32. export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline
  33.  
  34.  
  35. ################################
  36. ### Environment ###
  37. ################################
  38.  
  39. ##LANGUAGE=
  40. LC_ALL='en_US.UTF-8'
  41. LANG='en_US.UTF-8'
  42. LC_CTYPE=C
  43.  
  44. if [ -x /usr/bin/most ]; then
  45. export PAGER='most'
  46. else
  47. export PAGER='less'
  48. fi
  49.  
  50. if [ -x /usr/bin/vim ]; then
  51. export EDITOR='/usr/bin/vim'
  52. elif [ -x /bin/nano ]; then
  53. export EDITOR='/bin/nano'
  54. else
  55. export EDITOR='/bin/vi'
  56. fi
  57.  
  58. # Set xterm to 256 color for zenburn
  59. export TERM=xterm-256color
  60.  
  61. test "dumb" != $TERM && {
  62. # Set title of terminal to host name and working directory
  63. # add "set title" to your .vimrc and title will change to file name when vim is opened !
  64. host=$(uname -n)
  65. if [ "${TERM}" = "xterm" -o "${TERM}" = "xterm-color" ]
  66. then
  67. if [ -z "${BASH}" ]
  68. then
  69. echo "\033]2;${host}\007\033]1;${host}\007"
  70. else
  71. export PROMPT_COMMAND=\ 'echo -ne "\033]2;${host}:${PWD}\007\033]1;@${host}:${PWD}\007"'
  72. fi
  73. fi
  74. }
  75.  
  76. # Config xterm
  77. # also need ~/.Xresources
  78. if [ -e ~/.Xresources ] && [ ! -z "$DISPLAY" ]; then
  79. xrdb -merge .Xresources
  80. fi
  81.  
  82.  
  83. ################################
  84. ### PATH ###
  85. ################################
  86.  
  87. PATH='/bin:/usr/bin:/usr/local/bin'
  88. if [ $EUID = '0' ] || [ $EUID = '500' ] || [ $EUID = '1000' ]; then
  89. PATH=$PATH:/sbin:/usr/sbin:/usr/local/sbin
  90. fi
  91. if [ -d /usr/kerberos/bin ]; then
  92. PATH=$PATH:/usr/kerberos/bin
  93. fi
  94. if [ -d $HOME/bin ]; then
  95. PATH=$PATH:$HOME/bin
  96. fi
  97.  
  98. # Set your Time Zone
  99. TZ="America/Denver"
  100.  
  101.  
  102.  
  103. ################################
  104. ### Aliases ###
  105. ################################
  106.  
  107. alias ls='ls -c --color=auto'
  108. alias la='ls -ac --color=auto'
  109. alias ll='ls -lah --color=auto'
  110. alias lsd='ls -d */'
  111. alias lsz='ls -AZ --color=auto'
  112.  
  113. # with grep
  114. alias lsg='ls --color=auto | g'
  115. alias lag='ls -a --color=auto | g'
  116. alias llg='ls -lah --color=auto | g'
  117.  
  118. # Colorize grep
  119. alias g="grep --color=always"
  120. alias gi="grep -i --color=always"
  121.  
  122. # Confirm
  123. alias mv='mv -i'
  124. alias cp='cp -i'
  125. alias rm='rm -i'
  126.  
  127. # Override -f
  128. alias rmf='rm -Rfv'
  129. alias cpf='\cp -v'
  130. alias mvf='\mv -v'
  131. alias rmf='rm -Rfv'
  132.  
  133. # No colbber
  134. set -o noclobber # Override >|
  135.  
  136. # Sysadmin
  137. alias psa='ps auxf'
  138. alias psg='ps aux | grep' #requires an argument
  139. # alias date='date "+%A %B %d, %Y %l:%M %p %Z"'
  140. alias date='echo -ne "${LIGHTBLUE}";date "+%A %B %d, %Y %l:%M %p %Z"'
  141. alias cal='echo -e "${YELLOW}"; cal""'
  142. alias hist='history | g $1' #Requires one input
  143. alias du='du -sh'
  144. alias dul='\du -h | less'
  145. alias df='df -h'
  146.  
  147. alias edit="$EDITOR"
  148.  
  149. alias buddha='echo -e "${GREEN}"; clear ; display-dhammapada; echo -e "${CYAN}"" Peace be with you $USER" ; echo '
  150.  
  151. ################################
  152. ### Functions ###
  153. ################################
  154.  
  155. # Extract files from any archive
  156. # Usage: ex
  157.  
  158. function ex ()
  159. {
  160. if [ -f "$1" ] ; then
  161. case "$1" in
  162. *.tar) tar xvf $1 ;;
  163. *.tar.bz2 | *.tbz2 ) tar xjvf $1 ;;
  164. *.tar.gz | *.tgz ) tar xzvf $1 ;;
  165. *.bz2) bunzip2 $1 ;;
  166. *.rar) unrar x $1 ;;
  167. *.gz) gunzip $1 ;;
  168. *.zip) unzip $1 ;;
  169. *.Z) uncompress $1 ;;
  170. *.7z) 7z x $1 ;;
  171. *.xz) tar xJvf $1 ;;
  172. *.deb)
  173. DIR=${1%%_*.deb}
  174. ar xv $1
  175. mkdir ${DIR}
  176. tar -C ${DIR} -xzvf data.tar.gz
  177. ;;
  178. *.rpm) rpm2cpio $1 | cpio -vid ;;
  179. *) echo ""${1}" cannot be extracted via extract()" ;;
  180. esac
  181. else
  182. echo ""${1}" is not a valid file"
  183. fi
  184. }
  185.  
  186.  
  187.  
  188. # MOTD
  189. #
  190. #Display log in message w/ dhammapada
  191. # This if disables the MOTD for ssh / ftp / scp
  192. if [[ -n "$PS1" ]]; then
  193. clear
  194. cal -3
  195. echo
  196. # echo " " `date`
  197. # echo
  198. echo -ne "${RED}"; echo " " `uptime`
  199. if [ -x /usr/bin/display-dhammapada ]; then
  200. echo -e "${GREEN}"; /usr/bin/display-dhammapada
  201. else
  202. fi
  203. echo -e "${LIGHTYELLOW}";echo " " `ddate`; echo ""
  204. echo -ne "${LIGHTBLUE} Peace be with you $USER"
  205. echo
  206. echo
  207. fi
  208.  
RAW Paste Data
Top