Linux terminal users be like
Linux terminal users be like
Linux terminal users be like
ctrl + r
gang
Holy 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
Man I over use it at work - even when sitting in front of a pwsh prompt
You can also install https://github.com/dvorka/hstr to supercharge your ctrl+r
I can recommend fzf since it also supports searching the current directory
This is it, my first saved comment on lemmy
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.
Finally the ls command!
Fish gang arise (no need for ctrl+r, just press up)
Ctrl R > start typing
You're welcome to have your life changed
What the actual.... Thanks
Finally the ls
command!
Up up up up up up up up up oh wait down
you allllways overshoot
Based
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!
Bruh. Ctrl-r
you're amazing, this is going to change how I use fish
Or the history substring search plugin for zsh showing inline history as you type, like fish.
Bro, do you even ^R
?
ctrl+p gang RISE UP
cat /var/www/vhosts.d/l[tab]o[tab]l[tab]a[tab]...
lola 🤨?
cat /var/www/vhosts.d/lolanotherfilehasthesamenamebutwith1.conf
~/.bash_history is where my documentation lives
yeah, the other day i was supposed to remove a restriction from a router that was some custom thing built on a raspberry pi. i logged in, started messing around, trying to figure out the system, and of course i looked at bash_history because why not, i'm unfamiliar with the setup so it seemed like a good place to start. up until i found some commands editing it. so i'm like
undefined
$ export HISTFILE=/dev/null # alright, two can play this game
it ended up being a simply cron job that runs a script that starts and stops hostapd every once in a while. i didn't disable the cron job, i just commented out a critical line from the stop script. happy debugging to the sysadmin, lol
Time to up your game with Ctrl + R reverse search! 🤓
Oh, and Ctrl + Shift + R brings you back in the search, niiiiice.
Thank you kind stranger 👍 ☺️.
Woah. Quality of meme in this site amazes me.
It's more or less like on reddit, but less users.
*fewer
Or
history | grep {command}
i have a alias for h which is history, then hg which does this and i can search my whole 52 thousand line history file and find anything i've ran
"\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....
I'll be a madlad and thank you right here, right now!
Hey! Sorry just getting into Linux, I love learning about cool ways of doing things more efficiently. What does this do exactly? I've noticed others mentioning CTRL+R and I am not sure what that means either. Thank you!
Basically, while ctrl+r is nice, this is how I got used to use my system. What this does is enable search for when you press arrow up. If you type nothing then it’s default behavior but if you type “ssh” and then start pressing arrow up it will bring up the previous command that had the word ssh in. It’s worth it for someone who constantly forgets ctrl+r exists
ah there's my password...
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 wantGuilty. Even knowing better ways laziness wins. Skyrim console too.
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.
Wait until they learn that you can ctrl+u
when you mistyped your password in sudo
instead of spamming backspace...
Bro. You just changed my life and don't even realize it
What does that do?
I end up hitting Ctrl+u at work all the time and then being disappointed and holding backspace.
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
history | grep term
Me when configuring a switch.
Since this post triggered hidden gems: ^old^new
will substitute old
with new
from the last command and execute.
esc + k
for me!
(vi for life)
I usually do ctrl+r but with zsh I can type the beginning of the command and press up and it will search that way too.
fish automatically searches as you type, just start typing and press -> when you find the command you need.
Zsh does the same, though I think you need oh my zsh and a plugin for it.
Ctrl+R together with fzf
makes this obsolete
fzf
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
$ ls -la
ls -hal
ls -halal
Fish finally broke me of this habit, and now it's one of the first things I install on any system
One of the top reasons I use fish is that I never learned how to cycle through the results of ctrl+r in bash
another happy fish convert here too!
Fish? Please enlighten a casual user
Friendly Interactive SHell. I also use it, and I find some of the extra features delightful. I don't think it's POSIX compliant if you're one of the two dozen people who have to worry about that for your use case.
history | grep {some part of command}
Much more useful for going further back, even without grep.
As some one who SSH's from a phone to run Docker containers and will be moving the container volumes to a different location, I thank you for this lovely command.
And the command is something like ls -l
👍
I usually use ls -hal
.
ls -lah
is what I do 🙌
no I don't want to write the single word command out again I'd rather go up the history with more keypresses
I've just signed up to this site and I'm being personally attacked already. smh
I feel this in my soul. Or when you realize you're hitting up up up up to find something trivial like ls
and it would have been more efficient to just type ls
. LOL.
The command is ls
I try to avoid the terminal as much as I humanly can because of ergonomic issues like this.
y... you do realise this is a meme, right? If you want to find a specific command that you ran in the past, you can just hit ctrl-r and search for it? No-one is actually spamming the up key, it's a joke.
Huh, I never actually knew you could do that. But anyway, I disagree that people aren't spamming the up key. At least in my experience, basically everyone I've ever seen use the terminal has always just spammed the up key to get the command they want. Many people don't get around to using the shortcuts like the one you mentioned because they're not really discoverable or obvious, so everything tends to become super painful and slow.
Besides, my overall point was that there are all sorts of annoyances like the one mentioned in the post that keep me away from the terminal. Stuff like not being able to click anywhere within a long command to immediately move your cursor to it (yes I know you can just use Ctrl+Left Arrow to move back really quickly, but it's just slow) or how Ctrl+C and Ctrl+V don't actually work the way you expect them to.
Easier to type history
then !xx
where xx is the number of record in history.