Everyone sharing their Ctrl+R tips, here’s my Control+R question:
How does scope work? Some command history only seems to exist in certain tabs.
Also sometimes I Ctrl+R in a tab then the command is there but I forget I need a different one first, so I ctrl+c but the next time I search for that original command somehow it doesn’t exist anymore.
I’m using the default terminal on Nobara (fedora based).
This actually doesn’t depend on your terminal but on the shell running inside it. Bash is the default on most distros. I have also frequently had this issue. There might be config to fix it.
I switched to fish instead of bash, and now I use fzf and the https://github.com/PatrickF1/fzf.fish plugin and it works GREAT. There might be a similar thing for bash, I don’t know.
As far as I remember, there is a bash setting that controls whether the command history is written immediately after execution (in which case it is immediately available on all tabs/windows of the console) or after closing the session (in which case it will be available next time/potentially lost if the window is forcibly closed etc).
The default is the second one as far as I remember.
That said, I had changed to a more powerful one in zsh years ago, so it’s been a while…
Thanks, I worked it out. Not a setting as such, but you can use PROMPT_COMMAND to run an action to insert into history each time a prompt is run, as described here.
Though I have started down a rabbit hole of looking at other options for the shell.
Everyone sharing their Ctrl+R tips, here’s my Control+R question:
How does scope work? Some command history only seems to exist in certain tabs.
Also sometimes I Ctrl+R in a tab then the command is there but I forget I need a different one first, so I ctrl+c but the next time I search for that original command somehow it doesn’t exist anymore.
I’m using the default terminal on Nobara (fedora based).
This actually doesn’t depend on your terminal but on the shell running inside it. Bash is the default on most distros. I have also frequently had this issue. There might be config to fix it.
I switched to fish instead of bash, and now I use fzf and the https://github.com/PatrickF1/fzf.fish plugin and it works GREAT. There might be a similar thing for bash, I don’t know.
That looks awesome! Thanks for the rabbit hole 😅
As far as I remember, there is a bash setting that controls whether the command history is written immediately after execution (in which case it is immediately available on all tabs/windows of the console) or after closing the session (in which case it will be available next time/potentially lost if the window is forcibly closed etc).
The default is the second one as far as I remember.
That said, I had changed to a more powerful one in zsh years ago, so it’s been a while…
Thanks, I worked it out. Not a setting as such, but you can use PROMPT_COMMAND to run an action to insert into history each time a prompt is run, as described here.
Though I have started down a rabbit hole of looking at other options for the shell.