I have been suggested alternative programs to install to work with Ctrl+r, which are supposed to work better, but I just end up using kwrite ~/.bash_history when Ctrl+r fails.
I accidentally stumbled across Ctrl+r over a decade ago and I still don’t understand properly how it works. So I usually egrep -e someInsaneRegex ~/.bash_history
The part of the tech stack that handles all these command editing and navigation shortcuts is the readline library. Check out man readline. There’s an entire section on searching. readline is used for lots of other interpreters, too.
interesting, didn’t know that… Will try!
Finding out about “Ctrl-r” also was a gamechanger.
What does CTRL+R do?
Lets you easily and interactively search your command history.
Half the stuff I do is usually preceded by that, it’s really useful!
Oh that is nice, I usually use ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
That’s part of the natural progression. Can’t remember if that comes before or after “history | grew command.”
Adding fzf to the mix makes Ctrl+r even better.
Just wait until you discover fish/zsh autosuggestions.
As annoying as using a non-posix compatible shell sometimes is, fish saves me so much time
I have been suggested alternative programs to install to work with
Ctrl+r, which are supposed to work better, but I just end up usingkwrite ~/.bash_historywhenCtrl+rfails.Next step is discovering atuin! https://atuin.sh/
I love atuin!
Thanks!
Haven’t heard that one before. Comes on my growing list of all the stuff I wanna try/setup…
I accidentally stumbled across Ctrl+r over a decade ago and I still don’t understand properly how it works. So I usually egrep -e someInsaneRegex ~/.bash_history
The part of the tech stack that handles all these command editing and navigation shortcuts is the readline library. Check out
man readline. There’s an entire section on searching. readline is used for lots of other interpreters, too.That is worth it for more complicated things like, “I want all commands that started with git and contained ‘foo’”
Did it like that before, but Ctrl-r is typically just a lot faster.
If you install a fuzzyfinder, like fzf, or skim, you get previews of the search query result and fuzzy search, which is really cool, too.
Ctrl+r is cool, but atuin is oh my gosh great
https://atuin.sh/
isn’t that just fzf with ctrl-R binding
I didn’t know fzf yet. Neat
dude holy shit that is AWESOME! i had something similar, but it was a custom function.
srch() { cat ~/.bash_history | grep -Ein “$@”}
Did you know that grep can take the name of the file(s) you want it to search as the final arguments?
For example:
grep -Ein "$@" ~/.bash_historyi always pipe into grep so sometimes i forget that’s even an option, lol