Notes
Saved for later

My bash tricks





These are the configurations I add to any machine running bash

Ignore case

This is how to make bash ignore the case of filenames when doing tab-completion.

Add the following into ~/.inputrc

set completion-ignore-case On

Restart the shell

~/.bashrc

# Make sure to get English error messages
export LC_ALL="en_US.UTF-8"
export LC_CTYPE=$LC_ALL
export LANG=$LC_ALL
export LANGUAGE=$LC_ALL
export LANG="en_US"

# Easy access to my own scripts
export PATH="$PATH:~/bin/"

# Better safe
alias mv="mv -i"

# Add some color to the shell
alias ls="ls --color"
alias grep="grep --color"

# Default editor and browser
export VISUAL=nano
export BROWSER=google-chrome

#Git, show that you are in a git repo and which branch
function parse_git_branch {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1]/"
}

#Default user, green username
export PS1='\[\033[01;32m\]\u \[\033[01;34m\]\h \w\[\033[1;33m\]$(parse_git_branch)\[\033[0m\] '
#Root user, red username
export PS1='\[\033[01;31m\]\u \[\033[01;34m\]\h \w #\[\033[00m\] '
Creative Commons License