Tip to improve bash history

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Already wanted this feature for ages, now finally discovered how you can
get it to work in bash.

Let's say you have the typed following history in bash

info gcc
make
vi main.c
make
vi Makefile


Now you want to issue another "info gcc". You could press the up arrow
four times but if you bind the <up arrow> to "history-search-backward"
instead of "previous-history" you can type the first characters of the
line you want to repeat and then push the <up arrow>. In this case you
would type i <up arrow> and bash already presents you with the "info
gcc" line. "history-search-backward" and "history-search-forward" only
show you the history entries which match with the character you already
typed. If you do not type anything it just works like the normal
history.

To get this behaviour always add the following two lines to your
/etc/inputrc

"\M-[A":history-search-backward
"\M-[B":history-search-forward

Have fun with it

Jaap





[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux