Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of my favorite bash shortcuts is binding the up arrow to history-search-backward. This is the first page I found that concisely explains how; the variant in the second comment is the one actually in my .bashrc:

http://hints.macworld.com/article.php?story=2003102617423686...

So if you've typed `verylongcommand` some indeterminate time in the past, you can probably just type "ver<up>", and you'll have it. Very convenient.



A quick look at the article shows it's binding history search. It's already bind to ctrl-r - you can do a ctrl-r, type a few letters of the long commands, and keep doing a ctrl-r till you find the right match.

Apart from additional bind your setup requires, arrow keys are near impossible to touch type. Even if you can touch type them, that means taking your hands off the home row, and positioning them again.


I think with the parent's setup you can do ver<C-p> to get the same effect.


I use ctrl-P/N for history-beginning-search-{backward,forward} in Zsh. Type the start of a previous command and cycle through the matches.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: