My brother keeps mentioning zsh.. Here's my answer, for now..
Settings created in your shell:
- share ~/.history across terminal windows
- auto remove duplicates from ~/.history
- add multi-line cmds to a single entry in ~/.history
- your ~/.history always saved, no need hit Ctrl-D or type 'exit'
- auto correct small typos and case mis-match in file and dir matching and TAB completions
- case insensitive file/dir matching and TAB completions
- add SHIFT-TAB completion: uses an alternate, inline, cycle-through-options style TAB completion
Add the following into your BASH settings file /root/.bashrc:
Code: Select all
# allow shortcuts to directories
#
# usage example: cd $docs
#
shopt -s cdable_vars
# example shortcuts
export docs="/usr/share/docs"
export menufiles="/usr/share/applications"
# better typo support
#
#enable spell checking of files and dirs in the shell
shopt -s cdspell
#make file/dir matching case insensitive
shopt -s nocaseglob
#make TAB completion of file/dir names case insensitive
bind 'set completion-ignore-case on'
# fix cmd typos
alias ehco='echo'
alias ehoc='echo'
alias ehcp='echo'
alias dinf='find'
alias fidn='find'
alias findf='find'
alias gerp='grep'
alias gepr='grep'
alias egrp='grep'
# better history management
#
#ignore adding duplicates to the history list, erase them too
export HISTCONTROL=erasedups
# enabled shared history across terminal windows .. histappend not needed below
#shopt -s histappend
#keep multi lines commands together on one line
shopt -s cmdhist
# the magic bit, does a few things, basically keeps your history tidy and up to date
export PROMPT_COMMAND="history -n; history -w; history -c; history -r; $PROMPT_COMMAND"
type 'exit' or hit Ctr-D in order to save your history.. it will get saved each time you execute a command.
However, using the PROMPT_COMMAND method as above will mess up the reported line number by the history command..
Also, here's another, simpler way to filter out duplicates:
Code: Select all
export HISTIGNORE="&"
Code: Select all
export HISTIGNORE="&:ls:exit"
Code: Select all
# enable a second inline style of auto completion with SHIFT-TAB:
"\e[Z": menu-complete
such as comparing the output of two commands :
Code: Select all
diff <(ls dir1) <(ls dir2)
http://unix.stackexchange.com/questions ... -or-tricks
http://www.catonmat.net/blog/top-ten-on ... explained/
http://www.catonmat.net/blog/the-next-t ... explained/
http://www.catonmat.net/blog/another-te ... explained/
http://www.catonmat.net/blog/yet-anothe ... explained/