# # ~/.bashrc -- Sourced by bash in interactive non-login shells. # Includes ~/.config/bashrc.d/* # # If not running interactively, don't do anything [[ $- != *i* ]] && return # Bash settings set -o noclobber shopt -s checkwinsize shopt -s histappend HISTCONTROL=ignoreboth HISTSIZE=20000 HISTFILESIZE=20000 PROMPT_DIRTRIM=3 # Save and display timestamps for history HISTTIMEFORMAT="[%F %T] " # Color output and default options GREP_OPTS='--color=auto' LS_OPTS='--color=auto -hFN --group-directories-first' export LESS="-Ri" # colored GCC warnings and errors export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' # Set default options alias ls='ls ${LS_OPTS}' alias grep='grep ${GREP_OPTS}' alias diff='diff --color=auto' alias ip='ip -color=auto' # Common shortcut aliases alias l='ls -l' alias la='ls -a' alias ll='ls -la' # Colored man pages man() { env \ LESS_TERMCAP_mb=$(printf "\e[1;31m") \ LESS_TERMCAP_md=$(printf "\e[1;31m") \ LESS_TERMCAP_me=$(printf "\e[0m") \ LESS_TERMCAP_se=$(printf "\e[0m") \ LESS_TERMCAP_so=$(printf "\e[1;44;33m") \ LESS_TERMCAP_ue=$(printf "\e[0m") \ LESS_TERMCAP_us=$(printf "\e[1;32m") \ man "$@" } # (Other aliases are defined in .bashrc.d/10_common_aliases.sh etc.) # Load z [[ -r "/usr/share/z/z.sh" ]] && source /usr/share/z/z.sh # Define colors for bash prompt (will also be used in .bashrc.local) TRED='\[\e[0;31m\]' # Red TGREEN='\[\e[0;32m\]' # Green TBLUE='\[\e[0;34m\]' # Blue TGREENB='\[\e[1;32m\]' # Green bold TCYANB='\[\e[1;36m\]' # Cyan bold TWHITEB='\[\e[1;37m\]' # White bold TRESET='\[\e[0m\]' # Text Reset # Set default prompt if [[ ${EUID} == 0 ]] ; then PS1="${TRED}\u@\h ${TBLUE}\w ${TWHITEB}\$ ${TRESET}" else PS1="${TGREEN}\u@\h ${TBLUE}\w ${TWHITEB}\$ ${TRESET}" fi # Include drop-in files if [[ -d ~/.config/bashrc.d ]]; then for f in ~/.config/bashrc.d/*; do [[ -f $f ]] && source "$f" done fi # Deprecation warning for old drop-in file locations if [[ -e ~/.bashrc.d || -e ~/.bashrc.local ]]; then echo "WARNING: ~/.bashrc.d and ~/.bashrc.local are ignored, please use ~/.config/bashrc.d/ instead." fi # Clean up environment variables unset TRED TGREEN TBLUE TGREENB TCYANB TWHITEB TRESET