I originally wrote a spec in 2006, but it never actually made it in.  You can see it at https://wiki.ubuntu.com/Spec/EnhancedBash .  The good news is, it is just as relevant today. Hopefully these tips will make your life easier, I use them on all of my systems.

Use the page up key to complete the command
What this does is, if I type ’ssh ‘ then hit the page-up key, it will complete the line to the last time in my history file that I typed ssh. Hitting page up again will go to the 2nd to last time I typed it. Incredibly handy if you ever type the same commands more than once. This actually has been the default of SUSE based distributions for quite some time.


echo "\"\e[5~\": history-search-backward" >> ~/.inputrc
echo "\"\e[6~\": history-search-forward" >> ~/.inputrc

Increase history size
Now that you have the pageup / pagedown bindings to auto-complete your history, you are going to want to store more of it. You can store the previous 1000 commands using this.


echo "export HISTSIZE=1000" >> ~/.bashrc
echo "export HISTFILESIZE=1000" >> ~/.bashrc

Color grep
Using the following bash alias, you can make grep highlight the word it is matching in color. I grep about 10000 times a day, so this makes it a bit easier on my eyes to focus where I need to:


echo "export GREP_OPTIONS='--color=auto'" >> ~/.bashrc

Command matching
There was also someone who contributed more sane command matching (ie what happens when you hit the tab key a bunch). I use these also, which tell it not to do stupid things like try to match hidden files and to display both files if they are ambiguous:


echo "set match-hidden-files off" >> ~/.inputrc
echo "set page-completions off" >> ~/.inputrc
echo "set completion-query-items 350" >> ~/.inputrc
echo "set show-all-if-ambiguous on" >> ~/.inputrc

Related posts:

  1. Connecting to Ubuntu from Windows Recently I needed to connect to a Ubuntu box from...
  2. The Cherokee Webserver: Great choice for VPS’s Recently I upgraded my shared hosting plan to a VPS...
  3. Fixing configuration files I read on twitter from Ryan Gordon: ” So I...
  4. Python threads Frequently I need to launch sub processes from Python. Sometimes...