Sunday, October 10, 2010

Bash Tweaks

Some useful bash tweaks. It's no surprise that they're placed in '~/.bashrc' file.

excerpt from ~/.bashrc
PS1='\u@\h:\!:\#:\W\$ '
PROMPT_DIRTRIM=3
CDPATH='.:..:~:~/projects'
unset PROMPT_COMMAND
unset MAILCHECK

shopt -s autocd checkjobs cmdhist dotglob histappend \
         histreedit histverify lithist no_empty_cmd_completion

bind -m vi-insert '"\C-e":shell-expand-line'
bind -m vi-command '"\C-e":shell-expand-line'
bind -m vi-insert '"\ee":history-and-alias-expand-line'
bind -m vi-insert '"\eE":history-and-alias-expand-line'
bind -m vi-command '"\ee":history-and-alias-expand-line'
bind -m vi-command '"\eE":history-and-alias-expand-line'
bind -m vi-insert '"\ei":complete-filename'
bind -m vi-insert '"\eI":complete-filename'
bind -m vi-insert '"\e\t":dynamic-complete-history'
bind -m vi-insert '"\eq":dabbrev-expand'

export HISTCONTROL='erasedups'
export HISTFILESIZE='5000'
export HISTSIZE='500'
export HISTIGNORE='exit'

If you're wondering what they do consult 'man bash'.