3 ms·
This is why these things are so personal. I'd hate this. The up/down bindings are absolutely tied to specific command orders in my head. I need to know that "
by ajross 11y ago
This is why these things are so personal. I'd hate this. The up/down bindings are absolutely tied to specific command orders in my head. I need to know that "three commands back" is wherever I was in the sequence of commands that I'm repeating.
If I'm trying to semantically query my history (for "ssh") in this case I'll use the ^R binding to incrementally search the history, or literally grep ~/.history for what I'm looking for.
That's not to say that you're "wrong", just that calling these things "sensible defaults" is sort of missing the point. Nothing about them is sensible for everyone.
- omalsa04 11y agoIf you just press "up" without typing anything first then it works as you expect. I find ^R annoying if I've already started typing the command and then realise I can search the history (although that's probably configurable). Once you get used to it, the only downside of up/down history search is when you ever use a shell that doesn't do it and you feel lost.
- zo1 11y agoOn a standard Ubuntu install: If you press ^R after already typing part of what you're searching for, and then press a key (space, or more of the command you're searching for), then it'll switch to the history-search mode with that value pre-filled in.
- plorg 11y agoI have it as "\e[5~": history-search-backward "\e[6~": history-search-forward This allows you to continue using arrows for absolute chronological history then use PageUp and PageDn for history search. You could also change it to "\e[5~": history-substring-search-backward "\e[6~": history-substring-search-forward if you want to search for a string match anywhere in the command rather than at the beginning. It might be 'substr' rather than 'substring' depending on your Bash version. Obviously the utility of this depends on your keyboard layout and config, as much as it does on personal preferences. You can see the full list of commands at https://www.gnu.org/software/bash/manual/html_node/Commands-For-History.html https://www.gnu.org/software/bash/manual/html_node/Commands-....
- deleted 11y ago[deleted]
- thom_nic 11y agoYup, it changes the default behavior slightly but as @omalsa04 mentioned if you just hit <up> without typing anything it will iterate through the whole command history, the same as it would without this binding.