Making the bash (history) a better place
One thing that I always miss in the default installation of current distributions is the proper handling of the bash history.
Missing history data
Everyone who works with more than one session on the same machine will know this. You come back the next day and want to rerun a command from the day before, maybe it was quite tricky or you’re just too lazy to write it again. You search the history but can’t find it. Thats because one session overwrites all other concurrent ones when it ends.
The easy fix for that is to add the following to your ‘/etc/bash.bashrc’ (or equal) file. You might want to add it only to your own users ‘~/.bashrc’ file.
shopt -s histappend
Duplicate history data
Another annoyance is that you might use a command over and over again, but then you want to go back to the command you used right before. But cursor-key up brings you only the repeated command again and again. To stop the history of saving duplicate entries you just need to add this line to the ‘.bashrc’ file:
Larger size of history
One more thing you might want to do is to up the limit of the lines that the history saves. The default is 500, which, to be honest, isn’t that big! Sometimes you just need that command you remembered you ran a month ago, but its gone now. So, increase the history size!
This one is the most important one to me. There are commands that you use every day, and you don’t wanna type them in day after day after day. So you just need to search the history. You can do that with CTRL-r, but thats not as quick and not as easy as the method I’m used to use. Start entering your command and press page-up or page-down to scroll through all commands that started like what you entered right before. To activate this functionality you need to add (or uncomment, debian and ubuntu already have that in the file) these two lines to your ‘/etc/inputrc’ file, or of course to your users ‘.inputrc’ file:
"\e[5~": history-search-backward "\e[6~": history-search-forward
Once you are used to this stuff you never want to miss it again!
As a note, Linux Commando is a good source for more things that make your command line experience easier!