Commit d84428e03fbe848d709c89e090b19af8751bc7d0
1 parent
4fd2a9e0fd
Exists in
master
new bashrc
Showing 1 changed file with 185 additions and 13 deletions Inline Diff
shell/bashrc
View file @
d84428e
# ~/.profile: executed by the command interpreter for login shells. | 1 | 1 | # ----------- | |
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login | 2 | 2 | # .bashrc | |
# exists. | 3 | 3 | # ----------- | |
# see /usr/share/doc/bash/examples/startup-files for examples. | 4 | |||
# the files are located in the bash-doc package. | 5 | |||
6 | 4 | |||
# the default umask is set in /etc/profile; for setting the umask | 7 | 5 | # If not running interactively, don't do anything | |
# for ssh logins, install and configure the libpam-umask package. | 8 | 6 | case $- in | |
7 | *i*) ;; | |||
8 | *) return;; | |||
9 | esac | |||
10 | ||||
11 | #sets the default permissions for newly created files | |||
#umask 022 | 9 | 12 | #umask 022 | |
10 | 13 | |||
# if running bash | 11 | 14 | # check the window size after each command and, if necessary, | |
if [ -n "$BASH_VERSION" ]; then | 12 | 15 | # update the values of LINES and COLUMNS. | |
# include .bashrc if it exists | 13 | 16 | shopt -s checkwinsize | |
if [ -f "$HOME/.bashrc" ]; then | 14 | 17 | ||
. "$HOME/.bashrc" | 15 | 18 | # If set, the pattern "**" used in a pathname expansion context will | |
19 | # match all files and zero or more directories and subdirectories. | |||
20 | #shopt -s globstar | |||
21 | ||||
22 | ||||
23 | ||||
24 | # ----------- | |||
25 | # Colors | |||
26 | # ----------- | |||
27 | ||||
28 | # we want lots of colors | |||
29 | export TERM=xterm-256color | |||
30 | ||||
31 | # set a fancy prompt (non-color, unless we know we "want" color) | |||
32 | case "$TERM" in | |||
33 | xterm-color) color_prompt=yes;; | |||
34 | esac | |||
35 | ||||
36 | # uncomment for a colored prompt, if the terminal has the capability; turned | |||
37 | # off by default to not distract the user: the focus in a terminal window | |||
38 | # should be on the output of commands, not on the prompt | |||
39 | #force_color_prompt=yes | |||
40 | ||||
41 | if [ -n "$force_color_prompt" ]; then | |||
42 | if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then | |||
43 | # We have color support; assume it's compliant with Ecma-48 | |||
44 | # (ISO/IEC-6429). (Lack of such support is extremely rare, and such | |||
45 | # a case would tend to support setf rather than setaf.) | |||
46 | color_prompt=yes | |||
47 | else | |||
48 | color_prompt= | |||
fi | 16 | 49 | fi | |
fi | 17 | 50 | fi | |
18 | 51 | |||
52 | if [ "$color_prompt" = yes ]; then | |||
53 | PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |||
54 | else | |||
55 | PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' | |||
56 | fi | |||
57 | unset color_prompt force_color_prompt | |||
58 | ||||
59 | # If this is an xterm set the title to user@host:dir | |||
60 | case "$TERM" in | |||
61 | xterm*|rxvt*) | |||
62 | PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" | |||
63 | ;; | |||
64 | *) | |||
65 | ;; | |||
66 | esac | |||
67 | ||||
68 | # enable color support of ls and also add handy aliases | |||
69 | if [ -x /usr/bin/dircolors ]; then | |||
70 | test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |||
71 | alias ls='ls --color=auto' | |||
72 | #alias dir='dir --color=auto' | |||
73 | #alias vdir='vdir --color=auto' | |||
74 | ||||
75 | alias grep='grep --color=auto' | |||
76 | #alias fgrep='fgrep --color=auto' | |||
77 | #alias egrep='egrep --color=auto' | |||
78 | fi | |||
79 | ||||
80 | # Less Colors for Man Pages | |||
81 | man() | |||
82 | { | |||
83 | # begin blinking | |||
84 | # begin bold | |||
85 | # end mode | |||
86 | # end standout-mode | |||
87 | # begin standout-mode - info box & search results | |||
88 | # end underline | |||
89 | # begin underline | |||
90 | env LESS_TERMCAP_mb=$'\E[01;31m' \ | |||
91 | LESS_TERMCAP_md=$'\E[01;38;5;74m' \ | |||
92 | LESS_TERMCAP_me=$'\E[0m' \ | |||
93 | LESS_TERMCAP_se=$'\E[0m' \ | |||
94 | LESS_TERMCAP_so=$'\E[42;5;246m' \ | |||
95 | LESS_TERMCAP_ue=$'\E[0m' \ | |||
96 | LESS_TERMCAP_us=$'\E[04;38;5;146m' \ | |||
97 | man "$@" | |||
98 | } | |||
99 | ||||
100 | ||||
101 | # ----------- | |||
102 | # History | |||
103 | # ----------- | |||
104 | ||||
105 | # don't put duplicate lines or lines starting with space in the history. | |||
106 | # See bash(1) for more options | |||
107 | HISTCONTROL=ignoreboth | |||
108 | ||||
109 | # append to the history file, don't overwrite it | |||
110 | shopt -s histappend | |||
111 | ||||
112 | # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |||
113 | HISTSIZE=1000 | |||
114 | HISTFILESIZE=2000 | |||
115 | ||||
116 | ||||
117 | ||||
118 | # ------------------- | |||
119 | # PATH | |||
120 | # ------------------- | |||
121 | ||||
# include sbin in PATH | 19 | 122 | # include sbin in PATH | |
if [ -d "/sbin" ] ; then | 20 | 123 | if [ -d "/sbin" ] ; then | |
PATH="/sbin:$PATH" | 21 | 124 | PATH="/sbin:$PATH" | |
fi | 22 | 125 | fi | |
if [ -d "/usr/sbin" ] ; then | 23 | 126 | if [ -d "/usr/sbin" ] ; then | |
PATH="/usr/sbin:$PATH" | 24 | 127 | PATH="/usr/sbin:$PATH" | |
fi | 25 | 128 | fi | |
# set PATH so it includes user's private bin if it exists | 26 | 129 | # set PATH so it includes user's private bin if it exists | |
if [ -d "$HOME/bin" ] ; then | 27 | 130 | if [ -d "$HOME/bin" ] ; then | |
PATH="$HOME/bin:$PATH" | 28 | 131 | PATH="$HOME/bin:$PATH" | |
fi | 29 | 132 | fi | |
30 | 133 | |||
134 | ||||
135 | ||||
136 | # ------------------- | |||
137 | # Default Apps | |||
138 | # ------------------- | |||
139 | ||||
140 | export PAGER='less' | |||
141 | export EDITOR='vim' | |||
142 | ||||
143 | ||||
144 | ||||
145 | # ------------------- | |||
146 | # Aliases | |||
147 | # ------------------- | |||
148 | ||||
149 | # Alias definitions. | |||
150 | if [ -f ~/.bash_aliases ]; then | |||
151 | . ~/.bash_aliases | |||
152 | fi | |||
153 | ||||
alias untar="tar -xf" | 31 | 154 | alias untar="tar -xf" | |
32 | 155 | |||
156 | # ls aliases | |||
157 | alias ll='ls -l' | |||
158 | #alias la='ls -A' | |||
159 | alias l='ls -CF' | |||
160 | ||||
161 | ||||
162 | ||||
163 | # ------------------- | |||
164 | # Bash Completion on steroids | |||
165 | # ------------------- | |||
166 | ||||
167 | # enable programmable completion features (you don't need to enable | |||
168 | # this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |||
169 | # sources /etc/bash.bashrc). | |||
170 | if ! shopt -oq posix; then | |||
171 | if [ -f /usr/share/bash-completion/bash_completion ]; then | |||
172 | . /usr/share/bash-completion/bash_completion | |||
173 | elif [ -f /etc/bash_completion ]; then | |||
174 | . /etc/bash_completion | |||
175 | fi | |||
176 | fi | |||
177 | ||||
178 | ||||
179 | ||||
180 | # ------------------- | |||
181 | # App specific stuff | |||
182 | # ------------------- | |||
183 | ||||
184 | #enable color in grep | |||
185 | export GREP_OPTIONS="--color=auto" | |||
186 | ||||
187 | #enable color, case-insensitive search, and no-wrapping in less | |||
188 | export LESS="-Sir" | |||
189 | ||||
#tell google chrome to use ram for cache | 33 | 190 | #tell google chrome to use ram for cache | |
export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" | 34 | 191 | export CHROMIUM_USER_FLAGS="--disk-cache-dir=/tmp" | |
192 | ||||
193 | ||||
194 | ||||
195 | # ------------------- | |||
196 | # Other | |||
197 | # ------------------- | |||
198 | ||||
199 | # make less more friendly for non-text input files, see lesspipe(1) | |||
200 | #[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |||
201 | ||||
202 | # set variable identifying the chroot you work in (used in the prompt below) | |||
203 | if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |||
204 | debian_chroot=$(cat /etc/debian_chroot) | |||
205 | fi | |||
35 | 206 | |||
207 | ||||