this post was submitted on 16 Aug 2024
375 points (96.1% liked)

Programmer Humor

19570 readers
1360 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] superkret@feddit.org 52 points 3 months ago (1 children)
[–] Fillicia@sh.itjust.works 36 points 3 months ago (8 children)

I really like this comic. Just in case someone didn't know in Linux you can:

-Ctrl + r to search previous commands

Or

-type history and precede the command number by an exclamation (!) to repeat the command (I.e. "!13")

[–] Aurenkin@sh.itjust.works 21 points 3 months ago* (last edited 3 months ago) (1 children)

Or just !! for the last command. Particularly helpful if you forgot to prefix it with sudo you can run sudo !!

[–] Redderthanmisty@lemmygrad.ml 2 points 3 months ago

Learn something new everyday

[–] vvv@programming.dev 8 points 3 months ago

I highly recommend installing fzf, and its shell integration. Makes your Ctrl + r magnitudes more pleasant to use!

[–] BlackPenguins@lemmy.world 7 points 3 months ago (1 children)

What. Da fuck. This always existed?!

[–] Trashboat@lemmy.blahaj.zone 8 points 3 months ago (1 children)

It’s probably from within the last 30 years or so

[–] BlackPenguins@lemmy.world 6 points 3 months ago

Oh good as long as it's only a recent update.

[–] Tetsuo@jlai.lu 6 points 3 months ago

Also if you put "sensitive" information in your history by mistake you can use "history -d <line#>" to remove it.

Unfortunately I had to use this command too many times.

[–] zarkanian@sh.itjust.works 5 points 3 months ago (1 children)

Fish shell does this automatically. It's one of the reasons I love it. You can auto-complete based on your command history.

[–] Fillicia@sh.itjust.works 4 points 3 months ago

I'm personlly a zsh+oh-my-zsh person which has the same type of auto complete option.

My only regret is that something broke the thefuck plugin on my pc and now swearing at my screen doesn't fix my mistakes.

[–] oxomoxo@lemmy.world 4 points 3 months ago

This works in Powershell as well, even on Windows...

[–] fmstrat@lemmy.nowsci.com 4 points 3 months ago

Or control R, start typing a bit, control r again.

[–] SpaceCadet@feddit.nl 1 points 2 months ago

Ctrl + r to search previous commands

That's a readline thing by the way, so it doesn't just work in bash but also works with other cli applications that are compiled with readline support, for example virsh, psql, fdisk, ...