6 ms·
Last year a friend taught me about the bash trick "CTRL-R" <start typing 'ssh' or some other previously run command> on the command line for reverse history sea
by colonhyphenp 17y ago
Last year a friend taught me about the bash trick "CTRL-R" <start typing 'ssh' or some other previously run command> on the command line for reverse history searching, and it is an amazing time saver. It acts as a great alternative to #8, "Find the last command that begins with “whatever,” but avoid running it"
$ !whatever:p
- oyving 17y agoAn important addition to that is to repeatedly hit ctrl-r to cycle through the matching commands in the history.
- erlanger 17y agoHow do you reverse the search? <S-C-R> didn't do it for me. Either way this could be a good substitute for what I do now, tediously grepping .zsh/bash_history...
- mziulu 17y agoIf by reverse you mean going forward instead of backwards, that should be done with Ctrl-S; it does not work in Bash though, since Ctrl-S locks the scrolling of the terminal. I believe this behavior can be overridden, through some .xinputrc settings perhaps, but I haven't still found enough motivation to look it up! edit: ok, I've found this: http://wiki.archlinux.org/index.php/Bash#History_search http://wiki.archlinux.org/index.php/Bash#History_search
- 10ren 17y agoI use up-arrow for that. My .inputrc has: "\e[A": history-search-backward If you don't type anything, it acts exactly as the old up-arrow.
- imurray 17y agoOr in ~/.zshrc: bindkey '\e[A' history-beginning-search-backward
- araneae 17y agoI'm pretty I learned this from reading an article on HN... anyone got a citation for me?
- pkrumins 17y agoPerhaps my article "The Definitive Guide to Bash History?" http://www.catonmat.net/blog/the-definitive-guide-to-bash-command-line-history/ http://www.catonmat.net/blog/the-definitive-guide-to-bash-co...