i just do a command close to what i want but slightly wrong just so i can do thefuck
bash users… zsh is much better
How?
type part of the command, then press up and it’ll complete it from your history….
also i suggest Oh-My-Zsh for nice colors in the terminal
the first time you do it you’ll get angry at all the time wasted in bash… also with oh my zsh it’ll show you what branch you’re in in a git repository… it’s great.Thanks! I have zsh on some of my machines, and installed zpresto on some but never got the advantages… probably due to bash muscle memory.
You also can get the git branch in bash, and a bunch of other $PS1 customizations are also possible (Tmux, ssh, time, background processes, etc).
I’ll try the up completion later :)
yeah you can do anything in bash….
zsh is really just an extension of bash, imo…
but the completion alone makes it worth it for me.
also colors in the terminal
Ctrl+R
I’m not going to say how long I used linux before learning this. It isn’t “this many days old”, but it may as well be.
I have 7 headless linux boxes running.
Hey! I’ve seen you before! You’re the unhinged jackass noticer!
…i looked in your comment history for too long to figure out why though. https://lemmy.world/comment/18001123
Wait till you learn about
!?
.^r is superior, though.
https://atuin.sh/ Does all that and a lot more, like showing if the command succeeded and which directory it was run in
This but with FZF and
ag
Even quicker with zsh or atuin: write the first few letters then arrow up to cycle through all matches
I main ZSH and I’ve been CTRL+R’ing for years damn here I am a fool
Glad to be of service
This is what I love about Linux - always learning new things!
I like to imagine someone added it in for their own personal use and told nobody because surely they are the only one.
I’m shocked how far I had to scroll down before it was mentioned, I was getting scared I would have to say it lol
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
Note: if the above isn’t working, you may need to first set your shell to accept emacs commands:
set -o emacs
Oh my freaking god thank you
Ctrl r
Almost, ctrl+R, ⬆️⬆️⬆️⬆️⬆️⬆️⬆️
The worst is when you remember doing something before, but don’t remember enough details to be able to effectively search for it.
Although, even then, I’m not going to just mindlessly hit “up”. Last time it happened I fed my command history through grep and removed all the things that I knew the command wasn’t. Just removing “ls” and “cd” from your history cuts the number of commands down by 80% or something.
Check out the fzf shell bindings. Reverse history search with fuzzy matching is one of the features.
That doesn’t help when you remember what effect the command had but nothing about what the command itself looked like.
I love this one but is the gif moving at 0.5 frames a second or is it just me
Normal for me. Thanks for pointing out it was a gif. I never realize they’re gifs because I have to “open in external” for them to actually move.
It works fine for me if I click on it but the embedded one is stuttering.
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 + FZF is the goat. You just need to vaguely remember the command and you’ll find it.
This changed my life when I discovered it. Also using
ag
as alternative to ack.FZF Vim plugin is also gold!
Fuck that hits so hard.
Care to explain to an uninitiated?
Every time you hit the up arrow, it shows the previous command you used in the terminal.
So hitting the arrow once gives your last used, hitting it twice gives your second to last command, and so on.
Yup and that is me. I could just history grep the command I want but I SWEAR it was just 2 commands ago, or 15 up arrows. lol.
Ohhh! I can absolutely relate to this as well! Using a zmud client to play games on. which is probably not much different, looking, than a terminal anyways
Multi user dungeon? What do you play?
Did. It’s long gone
Was a modified circlemud. Mostly fantasy. Was a mish mash of popular fantasy worlds. Feist, Tolkien, various DnD settings, letter on they tried to go away from fandom content.
Had any 29 classes, could “remort” keeping 15% of your skills. And had other benefits such as lowering some level requirements here and there.
Was riftsmud.net:4000 originally but they ended up having to move a could times.
About 40 players at peak times, maybe 100 players altogether that played any amount
More like ⬆️⬆️⬆️⬆️⬆️⬆️ mother fucker ⬇️
⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️⬆️
CTL+C
history
history | less
⬆️⬆️⬆️
Pg-up
…
Pg-up
…
q
! 2648
What, and type ‘ls’ again?
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.
I don’t see how this is relevant but thanks for the tip.
I offered one for !ssh, then noticed people were giving other obscure tips so i offered this one.
… And waste an opportunity to type on my ludicrously expensive mechanical keyboard?
FRIG no
!ssh
run the last command that started with ssh
I… Well… Thank you !
It’s as amazing as it is dangerous :) use with care!
history | grep thethingyou'relookingfor
deleted by creator
Blasphemy
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
wao
I’m begging you to use CTRL+R
If you have a fzf or other plugin installed, great. the vanilla Ctrl R is kinda mid in most shells IMO
It’s still lighyears ahead of hitting up forty times.
exactly, which is why
history | grep
can, in some cases, be better than vanilla Ctrl + R
You can also create aliases for frequently used commands. You can even put a function in an alias so it can accept arguments, but it would probably be better to just write a shell script at that point.