15/02/2009
a small tip for more efficient command line usage on debian
Debian is one of the few distros that you can’t search the bash history backward or forward for past commands by default.
To change that behaviour you need to uncomment two lines inside /etc/inputrc.
Change:
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
To:
# alternate mappings for "page up" and "page down" to search the history
"\e[5~": history-search-backward
"\e[6~": history-search-forward
Example usage:
To search through your old commands that started with “ssh” (e.g. ssh -p 551 koko@lala.gr, ssh foo@bar.gr, ssh test@koko.gr -L1111:1.2.3.4:9876), just type ssh and hit PgUp, you will see the previous ssh commands appearing on the command line.
$ ssh[PgUp]
transforms to $ ssh -p 551 koko@lala.gr
hit PgUp again and it transforms to
$ ssh foo@bar.gr
PgUp and it becomes $ ssh test@koko.gr -L1111:1.2.3.4:9876
Filed by kargig at 12:06 under Linux
6 Comments | 8,919 views
Are you aware of Ctrl+R?
I find PgUp/PgDn much easier to use than pressing ctrl+R over and over … don’t you ?
You can press Ctrl+R and start typing something and it will find you the closest match.
Using Page Up, Page Down is indeed faster and more easily used in addition to being an alternative.
Why?
Well you can’t just first type something and then hit Ctrl-R, can you?
this is the first change i do on a debian 😉
i have to admit i find debian to be very “vanilla” for my taste.
I wrote a little command which provide an alternative for history search. It restricts the visible history entries as you type on-the-fly.
http://www.idiap.ch/~fleuret/software.html#selector