What I love about the default Bash Crtl-C behaviour is that once a command has been located, the bash history is moved to the history of that command, until Enter is pressed.
$ a
bash: a: command not found
$ b
bash: b: command not found
$ c
bash: c: command not found
$ d
bash: d: command not found
$ <CTRL-R> b <UP>
$ a
That's great if I don't remember which command I was experimenting with, but I do know other commands that I did around that time (usually a file that I edited with VIM).
If you use multiple terminals it kinda sucks unless you do export PROMPT_COMMAND='history -a' in your.bashrc or something cause only the last closed terminal saves to history
export EDITOR=vi and then hitting Esc puts you into vi mode; k, j to move up/down through history or pressing / to search etc including using regex is all available.
I'm familiar with ctrl-r, but I still very much like the up-arrow behavior described by that commenter.
What I love about the default Bash Crtl-C behaviour is that once a command has been located, the bash history is moved to the history of that command, until Enter is pressed.
That's great if I don't remember which command I was experimenting with, but I do know other commands that I did around that time (usually a file that I edited with VIM).
Looking at it from a "law of least surprise" angle, it's exactly how it should behave.
"I typed 'cd di↑' and you're giving me 'pwd'??"
Atuin[1] feels like the best of both worlds to me.
[1] https://github.com/atuinsh/atuin
If you use multiple terminals it kinda sucks unless you do export PROMPT_COMMAND='history -a' in your.bashrc or something cause only the last closed terminal saves to history
There is a difference, I believe. Doesn't Ctrl+r do a substring search instead?
Yes it's different: it will match anywhere in the previous command lines.
And once you want to one-up this look into fzf.
And once you get tired of fzf and want something better, you reach for https://atuin.sh.
Completely transformed all of my workflows
From the atuin.sh website
> Sync your shell history to all of your machines
I think of my shell history as very machine specific. Can you give some insights on how you benefit from history sync? If you use it.
7 replies →
Prefix search is faster for the majority of cases. CTRL-r / FZF is useful for the remaining ones.
export EDITOR=vi and then hitting Esc puts you into vi mode; k, j to move up/down through history or pressing / to search etc including using regex is all available.