ctrl + r
gangHoly Crap. I have gotten into the arrow up mode. Then I went to History.
But, but, but ctrl + r. Holy crap.
Thank you kind sir or madam.
If you enjoy that, then let me introduce you you fzf - a fuzzy finder that has support for replacing ctrl + r in shells with fuzzy matching. Among other uses.
https://github.com/junegunn/fzf#key-bindings-for-command-line
Thank you very much.
Man I over use it at work - even when sitting in front of a pwsh prompt
pwsh with nushell is pretty good
You can also install https://github.com/dvorka/hstr to supercharge your
ctrl+r
Is there a MacOS versión of this? Asking for a friend.
It’s the same,
ctrl
+r
. It is a bash/shell thing so works on any os that uses bash or similar shells. Note, it is not the command key, but ctrl, unlike a lot of other shortcuts on macos.
Fish gang arise (no need for ctrl+r, just press up)
Ctrl R > start typing
You’re welcome to have your life changed
Bruh. Ctrl-r
ctrl + r then enter phrase
With fzf!
I haven’t been on linux in a while but i remember using a file manager that had fuzzy finder and it was nice. I miss linux actually. oh well!
Bro, do you even
^R
?Y’all know about ctrl-r to search history, right? I went for so many years without even thinking to look for something better than up-arrow, so I have to mention it.
history | grep <search term>
Does the job well if the key combo doesn’t work.
Followed by !xxx where xxx is the number of the command to re-run
This. I didn’t know about CTRL+R, but this has been my goto
Wait until they learn that you can
ctrl+u
when you mistyped your password insudo
instead of spamming backspace…What does that do?
Delete until start of line. So essentially equivalent to spamming backspace a bunch.
ctrl+p gang RISE UP
Woah. Quality of meme in this site amazes me.
It’s more or less like on reddit, but less users.
*fewer
cat .bash_history | grep keyword
But yeah pretty much.
Why not just
history | grep keyword
then? Works in any directory.You know you don’t actually have to do cat 😂. But yeah, I know, I do it as well 🤣.
Yeah, I grep on history and then !<number> to execute the line I want
Ctrl+R together with
fzf
makes this obsoletefzf
is pretty cool, but I found its ctrl-r “menu” to be more confusing than the old “one entry at a time” style.(Ofc could be a configuration thing but I’m somewhat an oldhat when it comes to my terminal habits.)
my humble method: history | grep -i searchterm
Then ![historynumber] to execute it
Since this post triggered hidden gems:
^old^new
will substituteold
withnew
from the last command and execute.- vim ~/.inputrc
- Paste the following:
"\e[A": history-search-backward "\e[B": history-search-forward
Thank me later
Ok this is actually great. Is there a way to make it so when you down arrow again it will clear the cmd line (or take it back to the prefix)?
Like “py” -> up -> down -> result is “py”
Currently it would show my last python command (or whatever matches).
Man, I’ve been on unix systems since, oh, 1994, but I’ve never messed with my .inputrc … may need to take the dive…
Guilty. Even knowing better ways laziness wins. Skyrim console too.
Or
history | grep {command}
Easier to type
history
then!xx
where xx is the number of record in history.