Bash config

From campisano.org
Jump to navigation Jump to search

Bash config files

#       /etc/bash.bashrc
#              The systemwide initialization file, executed for non-login shells
#       /etc/profile
#              The systemwide initialization file, executed for login shells
#       ~/.bash_profile, ~/.bash_login and ~/.profile
#              The personal initialization file, executed for login shells
#       ~/.bashrc
#              The individual per-interactive-shell startup file
#       ~/.bash_logout
#              The individual login shell cleanup file, executed when a login shell exits
#       ~/.inputrc
#              Individual readline initialization file


Show git current branch at prompt

See Git#Configure_shell_to_display_current_branch_in_PS1

Increment bash history size

Add this on your home .bashrc file:

export HISTSIZE=10000;           # default 500
export HISTFILESIZE=10000;       # default 500

Add timing information in bah history

export HISTTIMEFORMAT='%F %T ';

Disabling Bash history commands that start with space

Add this on your home .bashrc file:

export HISTCONTROL=ignorespace;

Making bash aliases

Add this on your home .bashrc file:

alias ls="/bin/ls -A -F -s -h --color";
alias cp="/bin/cp -i";
alias mv="/bin/mv -i";
alias rm="/bin/rm -i";
alias less="less -M";
alias pstree="pstree -plcnG";

Setting default umask for file permissions

Add this on your home .bashrc file:

umask 0007;

Setting ls files colors

Add this on your home .bashrc file:

export LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.bz2=01;31:*.rpm=01;31:*.deb=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.mpg=01;37:*.avi=01;37:*.mov=01;37:";