Advertisement
Guest User

Untitled

a guest
Sep 7th, 2015
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 5.82 KB | None | 0 0
  1. cat  ~/.bashrc
  2. # ~/.bashrc: executed by bash(1) for non-login shells.
  3. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
  4. # for examples
  5.  
  6. # If not running interactively, don't do anything
  7. [ -z "$PS1" ] && return
  8.  
  9. # don't put duplicate lines in the history. See bash(1) for more options
  10. # ... or force ignoredups and ignorespace
  11. HISTCONTROL=ignoredups:ignorespace
  12.  
  13. # append to the history file, don't overwrite it
  14. shopt -s histappend
  15. export GOPATH="$HOME/devel/go"
  16.  
  17. # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
  18. HISTSIZE=1000
  19. HISTFILESIZE=2000
  20.  
  21. # check the window size after each command and, if necessary,
  22. # update the values of LINES and COLUMNS.
  23. shopt -s checkwinsize
  24.  
  25. # make less more friendly for non-text input files, see lesspipe(1)
  26. [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
  27.  
  28. # set variable identifying the chroot you work in (used in the prompt below)
  29. if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then
  30.     debian_chroot=$(cat /etc/debian_chroot)
  31. fi
  32.  
  33. # Reset
  34. Color_Off="\[\033[0m\]"       # Text Reset
  35.  
  36. # Regular Colors
  37. Black="\[\033[0;30m\]"        # Black
  38. Red="\[\033[0;31m\]"          # Red
  39. Green="\[\033[0;32m\]"        # Green
  40. Yellow="\[\033[0;33m\]"       # Yellow
  41. Blue="\[\033[0;34m\]"         # Blue
  42. Purple="\[\033[0;35m\]"       # Purple
  43. Cyan="\[\033[0;36m\]"         # Cyan
  44. White="\[\033[0;37m\]"        # White
  45.  
  46. # Bold
  47. BBlack="\[\033[1;30m\]"       # Black
  48. BRed="\[\033[1;31m\]"         # Red
  49. BGreen="\[\033[1;32m\]"       # Green
  50. BYellow="\[\033[1;33m\]"      # Yellow
  51. BBlue="\[\033[1;34m\]"        # Blue
  52. BPurple="\[\033[1;35m\]"      # Purple
  53. BCyan="\[\033[1;36m\]"        # Cyan
  54. BWhite="\[\033[1;37m\]"       # White
  55.  
  56. # Underline
  57. UBlack="\[\033[4;30m\]"       # Black
  58. URed="\[\033[4;31m\]"         # Red
  59. UGreen="\[\033[4;32m\]"       # Green
  60. UYellow="\[\033[4;33m\]"      # Yellow
  61. UBlue="\[\033[4;34m\]"        # Blue
  62. UPurple="\[\033[4;35m\]"      # Purple
  63. UCyan="\[\033[4;36m\]"        # Cyan
  64. UWhite="\[\033[4;37m\]"       # White
  65.  
  66. # Background
  67. On_Black="\[\033[40m\]"       # Black
  68. On_Red="\[\033[41m\]"         # Red
  69. On_Green="\[\033[42m\]"       # Green
  70. On_Yellow="\[\033[43m\]"      # Yellow
  71. On_Blue="\[\033[44m\]"        # Blue
  72. On_Purple="\[\033[45m\]"      # Purple
  73. On_Cyan="\[\033[46m\]"        # Cyan
  74. On_White="\[\033[47m\]"       # White
  75.  
  76. # High Intensty
  77. IBlack="\[\033[0;90m\]"       # Black
  78. IRed="\[\033[0;91m\]"         # Red
  79. IGreen="\[\033[0;92m\]"       # Green
  80. IYellow="\[\033[0;93m\]"      # Yellow
  81. IBlue="\[\033[0;94m\]"        # Blue
  82. IPurple="\[\033[0;95m\]"      # Purple
  83. ICyan="\[\033[0;96m\]"        # Cyan
  84. IWhite="\[\033[0;97m\]"       # White
  85.  
  86. # Bold High Intensty
  87. BIBlack="\[\033[1;90m\]"      # Black
  88. BIRed="\[\033[1;91m\]"        # Red
  89. BIGreen="\[\033[1;92m\]"      # Green
  90. BIYellow="\[\033[1;93m\]"     # Yellow
  91. BIBlue="\[\033[1;94m\]"       # Blue
  92. BIPurple="\[\033[1;95m\]"     # Purple
  93. BICyan="\[\033[1;96m\]"       # Cyan
  94. BIWhite="\[\033[1;97m\]"      # White
  95.  
  96. # High Intensty backgrounds
  97. On_IBlack="\[\033[0;100m\]"   # Black
  98. On_IRed="\[\033[0;101m\]"     # Red
  99. On_IGreen="\[\033[0;102m\]"   # Green
  100. On_IYellow="\[\033[0;103m\]"  # Yellow
  101. On_IBlue="\[\033[0;104m\]"    # Blue
  102. On_IPurple="\[\033[10;95m\]"  # Purple
  103. On_ICyan="\[\033[0;106m\]"    # Cyan
  104. On_IWhite="\[\033[0;107m\]"   # White
  105.  
  106. # Various variables you might want for your PS1 prompt instead
  107. Time12h="\T"
  108. Time12a="\@"
  109. PathShort="\w"
  110. PathFull="\W"
  111. NewLine="\n"
  112. Jobs="\j"
  113. UserHost=$IGreen" \u@\h:"
  114.  
  115.  
  116. # This PS1 snippet was adopted from code for MAC/BSD I saw from: http://allancraig.net/index.php?option=com_content&view=article&id=108:ps1-export-command-for-git&catid=45:general&Itemid=96
  117. # I tweaked it to work on UBUNTU 11.04 & 11.10 plus made it mo' better
  118.  
  119. export PS1=$IBlack$Time12h$UserHost$Color_Off'$(git branch &>/dev/null;\
  120. if [ $? -eq 0 ]; then \
  121.  echo "$(echo `git status` | grep "nothing to commit" > /dev/null 2>&1; \
  122.  if [ "$?" -eq "0" ]; then \
  123.    # @4 - Clean repository - nothing to commit
  124.    echo "'$Green'"$(__git_ps1 " (%s) "); \
  125.  else \
  126.    # @5 - Changes to working tree
  127.    echo "'$IRed'"$(__git_ps1 " {%s} ")"'$Color_Off'"; \
  128.  fi) '$BYellow$PathShort$Color_Off' \$ "; \
  129. else \
  130.  # @2 - Prompt when not in GIT repo
  131.  echo " '$BIBlue$PathShort$Color_Off' \$ "; \
  132. fi)'
  133.  
  134.  
  135. # If this is an xterm set the title to user@host:dir
  136. case "$TERM" in
  137. xterm*|rxvt*)
  138.     PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
  139.     ;;
  140. *)
  141.     ;;
  142. esac
  143.  
  144. # enable color support of ls and also add handy aliases
  145. if [ -x /usr/bin/dircolors ]; then
  146.     test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
  147.     alias ls='ls --color=auto'
  148.     #alias dir='dir --color=auto'
  149.     #alias vdir='vdir --color=auto'
  150.  
  151.     alias grep='grep --color=auto'
  152.     alias fgrep='fgrep --color=auto'
  153.     alias egrep='egrep --color=auto'
  154. fi
  155.  
  156. # some more ls aliases
  157. alias ll='ls -alF'
  158. alias la='ls -A'
  159. alias l='ls -CF'
  160. alias sudo='sudo -i'
  161.  
  162. alias g='glances'
  163.  
  164. alias less='less -S'
  165.  
  166. # Add an "alert" alias for long running commands.  Use like so:
  167. #   sleep 10; alert
  168. alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'
  169.  
  170. # Alias definitions.
  171. # You may want to put all your additions into a separate file like
  172. # ~/.bash_aliases, instead of adding them here directly.
  173. # See /usr/share/doc/bash-doc/examples in the bash-doc package.
  174.  
  175. if [ -f ~/.bash_aliases ]; then
  176.     . ~/.bash_aliases
  177. fi
  178.  
  179. # enable programmable completion features (you don't need to enable
  180. # this, if it's already enabled in /etc/bash.bashrc and /etc/profile
  181. # sources /etc/bash.bashrc).
  182. if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
  183.     . /etc/bash_completion
  184. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement