# /etc/bash/bashrc # # This file is sourced by all *interactive* bash shells on startup, # including some apparently interactive shells such as scp and rcp # that can't tolerate any output. So make sure this doesn't display # anything or bad things will happen! # Return immediately for non-interactive shells (scp, rcp etc.) if [[ $- != *i* ]] ; then # Shell is non-interactive. Be done now! return fi # Shell options shopt -s checkwinsize # Update window size after each command shopt -s globstar 2>/dev/null # Enable ** recursive globbing shopt -s no_empty_cmd_completion # Disable completion on empty line # History settings shopt -s histappend # Append to history instead of overwriting shopt -s cmdhist # Save multi-line commands as one command PROMPT_COMMAND='history -a' # Record each line as it gets issued HISTSIZE=500000 HISTFILESIZE=100000 HISTCONTROL="erasedups:ignoreboth" export HISTIGNORE="&:[ ]*:exit:ls:bg:fg:history:clear" HISTTIMEFORMAT='%F %T ' bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' bind '"\e[C": forward-char' bind '"\e[D": backward-char' # Change the window title of X terminals case ${TERM} in [aEkx]term*|rxvt*|gnome*|konsole*|interix|tmux*) PS1='\[\033]0;\u@\h:\w\007\]' ;; screen*) PS1='\[\033_\u@\h:\w\033\\\]' ;; *) unset PS1 ;; esac PROMPT_DIRTRIM=2 # Color support use_color=false if type -P dircolors >/dev/null; then LS_COLORS= if [[ -f ~/.dir_colors ]]; then eval "$(dircolors -b ~/.dir_colors)" elif [[ -f /etc/DIR_COLORS ]]; then eval "$(dircolors -b /etc/DIR_COLORS)" else eval "$(dircolors -b)" fi [[ -n ${LS_COLORS:+set} ]] && use_color=true || unset LS_COLORS else case ${TERM} in [aEkx]term*|rxvt*|gnome*|konsole*|screen|tmux|cons25|*color) use_color=true ;; esac fi if ${use_color}; then if [[ ${EUID} == 0 ]]; then PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] ' # root else PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] ' # normal user fi #BSD#@export CLICOLOR=1 alias ls='ls --color=auto' alias grep='grep --colour=auto' else PS1+='\u@\h \w \$ ' fi # Additional features bind Space:magic-space # Enable history expansion with space bind "set completion-ignore-case on" # Perform file completion in a case insensitive fashion bind "set completion-map-case on" # Treat hyphens and underscores as equivalent bind "set show-all-if-ambiguous on" # Display matches for ambiguous patterns at first tab press bind "set mark-symlinked-directories on" # Immediately add a trailing slash when autocompleting symlinks to directories # Source additional configs for sh in /etc/bash/bashrc.d/*; do [[ -r ${sh} ]] && source "${sh}" done # Try to keep environment pollution down, EPA loves us. unset use_color sh