Ctrl+R
post
I used to be like this but people seriously. CTRL+R
Do it. Don't make this one of those things you've heard about and just never got around to trying. Open your terminal right now and CTRL+R and type any part of the command you did before. If the command you want is not showing first just hit CTRL+R again to go to the next one back.
DO IT.
Edit: I did learn from this thread today though that ZSH has it set to where you can just type part of what you're looking for then hit up to do the same thing. Neat!
Holy shit. I just tried it. ctrl+r is a revelation! How the fuck did I not know about this?
WHAT THE FUCJ IS THIS SORCERY BRO I'VE BEEN USING LINUX FOR AGES AND NEVER KNEW THIS BROOOOOOOOOO
You can empower Ctrl+r event more by using fzf. After I started using it, I can't imagine going back to without it.
If you want to level up ctrl-r, upgrade to Atuin: https://atuin.sh/
Edit: I did learn from this thread today though that ZSH has it set to where you can just type part of what you’re looking for then hit up to do the same thing. Neat!
Fish too, it's fantastic.
Ctrl + R and start typing the command, it'll come up, press enter. Im just more lazy because I know there are still faster ways.
Edit: instead of hitting enter, keep pressing ctrl + R to cycle through history commands that contain what you typed in
Pretty much, yeah.
Rather than jot down in a text file the various ffmpeg commands I use frequently...
Raktajino@laptop:~/Downloads$ history | grep ffmpeg
12 sudo apt install audacity gimp ffmpeg mplayer
184 history | grep ffmpeg
215 ffmpeg -i source.mkv -ss 629 -t 7 out.mkv
217 ffmpeg -i out.mkv -s 0.5 -vf scale=1280:720 out.mp4
218 ffmpeg -i out.mkv -ss 0.5 -vf scale=1280:720 out.mp4
231 ffmpeg -i out.mp4 -vf "subtitles=out.srt" final.mp4
503 ffmpeg -i toofat.wav toofat.mp3
...
682 history | grep ffmpeg
684 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2" out.gif
685 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" out.gif
686 ffmpeg -i 1.gif -i 2.gif -filter_complex "[1:0] [2:0] concat=n=2:v=1" -map '[v]' out.gif
687 history | grep ffmpeg
688 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 12:0] concat=n=2:v=1" -map '[v]' out.gif
689 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] 1:0] concat=n=2:v=1" -map '[v]' out.gif
690 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2:v=1" -map '[v]' out.gif
691 ffmpeg -i 1.gif -i 2.gif -filter_complex "[0:0] [1:0] concat=n=2" out.gif
694 history | grep ffmpeg
I like how 'history | grep ffmpeg' shows up twice
More like ⬆️⬆️⬆️⬆️⬆️⬆️ mother fucker ⬇️
I just mapped page-up to search (and you can too)
history | grep ‘part of the command I remember’
Ha... That as if I would ever remember the part of the tool instead of the fact what it did 🤣
history | grep [the thing]
CTRL+R [the thing]
please i beg you
history | grep thethingyou'relookingfor
Fuck that hits so hard.
zsh-history-substring-search
I lazily type part of the thing I want like "sys" and then ctrl+⬆️/⬇️ and sudo systemctl start libvirtd etc. appear like magic.
You're in vim, you forgot to sudo, the file is read only and you have loads of changed you don't feel like saving off to /tmp and playing the copy file shell game.
[esc]:w !sudo tee %
it shoves the current buffer through tee (termina adapter) with sudo privs vim will warn you that the file changed, just [esc]:q! and don't let it save, you already saved it.
just use atuin.
!ssh
run the last command that started with ssh
https://junegunn.github.io/fzf/shell-integration/
fzf is a nice tool for this and other things
I see everyone posting about Ctrl+R, here's a couple more useful CLI shortcuts you might enjoy:
cd - (change directory to $OLDPWD usually the previous directory)
git checkout - (similarly checkout the previous branch)
Ctrl+A (return caret to beginning of command, great when you forgot a positional argument and you were almost done typing the command)
Ctrl+E (similar to Ctrl+A but move to the end of the command)
Or just use fish shell. Rarely need ctrl+r anymore.
Report post
Report reason: ⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️"There it is" I'm in this picture and I don't like it

top 50 comments