BASHRC is the configurations file meant for terminal initialization (not login). It configures the BASH terminal into the specified settings according to user.
I'm currently maintaining this BASHRC configurations. Feel free to duplicate. I'll update it from time to time without notice.
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples.
[ -f /etc/environment ] && source /etc/environment
[ -f /etc/profile ] && source /etc/profile
[ -f ~/.bash_aliases ] && source ~/.bash_aliases
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# GENERAL CONFIGURATIONS
# ======================
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# specify my COLUMNS and LINES for terminal
export COLUMNS=80
export LINES=45
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
# [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# COLOR CONFIGURATIONS
# ====================
force_color_prompt=yes
#---------------------
case "$TERM" in
xterm-color|*-256color)
color_prompt=yes
;;
esac
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare,
# and such a case would tend to support setf rather than
# setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
unset force_color_prompt
if [ -x /usr/bin/dircolors ]; then # enable color supports
test -r ~/.dircolors && \
eval "$(dircolors -b ~/.dircolors)" || \
eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
fi
# TERMS CONFIGURATIONS
# ====================
case "$TERM" in
xterm*|rxvt*)
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\W\[\033[00m\]\$ '
else
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
fi
;;
*)
PS1='${debian_chroot:+($debian_chroot)}\u:\W\$ '
;;
esac
unset color_prompt
# BASH PROGRAMMABLE BASH COMPLETION
# =================================
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
fi
# local filesystem settings
# =========================
# current directory executables
PATH="${PATH}:./bin"
# xclip
if [ ! -z "$(which xclip)" ]; then
alias pbcopy='xclip -selection clipboard'
alias pbpaste='xclip -selection clipboard -o'
fi
# ssh agent
ssh_socket_path="${HOME}/.ssh/ssh_auth_sock"
if [ ! -S "$ssh_socket_path" ]; then
eval `ssh-agent -k 2> /dev/null` 2> /dev/null
unlink "$ssh_socket_path" 2> /dev/null
rm -f "$ssh_socket_path" 2> /dev/null
printf "[ INFO ] SSH " && eval `ssh-agent -s`
ln -sf "$SSH_AUTH_SOCK" "$ssh_socket_path"
fi
unset ssh_socket_path
# gpg agent
gpgconf --launch gpg-agent
export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)"
# ruby
export BUNDLE_PATH="$HOME/.gem"
if which ruby >/dev/null && which gem >/dev/null; then
PATH="$(ruby -r rubygems -e 'puts Gem.user_dir')/bin:$PATH"
fi
# Nvidia
nvidia_bb_switch="/proc/acpi/bbswitch"
if [ -f "$nvidia_bb_switch" ]; then
alias nvidia-off="sudo tee "$nvidia_bb_switch" <<<OFF"
alias nvidia-on="sudo tee "$nvidia_bb_switch" <<<ON"
fi
unset nvidia_bb_switch
# Snapcraft
if [ ! "$(which snap)" = "" ]; then
PATH="/snap/bin:$PATH"
fi
# Youtube-dl
if [ ! "$(which youtube-dl)" = "" ]; then
alias audio-dl="youtube-dl \
-f bestaudio \
--extract-audio \
--audio-format mp3 \
--audio-quality 0"
fi
# QEMU and Libvirt
export LIBVIRT_DEFAULT_URI="qemu:///system"
That's all about BASHRC configuration file.