718
siempre lo hago (eviltoast.org)
top 50 comments
sorted by: hot top controversial new old
[-] Evotech@lemmy.world 7 points 30 minutes ago
[-] Dave@lemmy.nz 1 points 3 minutes ago

Everyone sharing their Ctrl+R tips, here's my Control+R question:

How does scope work? Some command history only seems to exist in certain tabs.

Also sometimes I Ctrl+R in a tab then the command is there but I forget I need a different one first, so I ctrl+c but the next time I search for that original command somehow it doesn't exist anymore.

I'm using the default terminal on Nobara (fedora based).

[-] iAvicenna@lemmy.world 4 points 1 hour ago

history | grep then !cmd_number

[-] SCmSTR 1 points 35 minutes ago

If only you had a little picture to click on...

[-] bdonvr@thelemmy.club 37 points 4 hours ago* (last edited 2 hours ago)

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!

[-] lepinkainen@lemmy.world 5 points 1 hour ago

If you want to level up ctrl-r, upgrade to Atuin: https://atuin.sh/

[-] harsh3466@lemmy.ml 9 points 2 hours ago* (last edited 2 hours ago)

Holy shit. I just tried it. ctrl+r is a revelation! How the fuck did I not know about this?

[-] Danitos@reddthat.com 10 points 2 hours ago* (last edited 2 hours ago)

You can empower Ctrl+r event more by using fzf. After I started using it, I can't imagine going back to without it.

[-] AkatsukiLevi@lemmy.world 12 points 3 hours ago

WHAT THE FUCJ IS THIS SORCERY BRO I'VE BEEN USING LINUX FOR AGES AND NEVER KNEW THIS BROOOOOOOOOO

[-] The_Decryptor@aussie.zone 4 points 3 hours ago

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.

[-] theacharnian@lemmy.ca 11 points 4 hours ago

history | grep [the thing]

[-] bdonvr@thelemmy.club 15 points 4 hours ago

CTRL+R [the thing]

please i beg you

[-] theacharnian@lemmy.ca 5 points 4 hours ago

with grep I see all the alternatives, Ctl+R just shows me one

[-] Evotech@lemmy.world 1 points 28 minutes ago

You can press up

[-] disobey2623@lemmy.dbzer0.com 1 points 35 minutes ago

Combine ctrl+R with fzf and get the best of both worlds

[-] oddlyqueer@lemmy.ml 6 points 2 hours ago

For me ctrl-r is faster most of the time, history | grep [command] is better if I can't easily pattern match (don't remember it exactly, using several flag variations, etc.). they're both good tools.

[-] surewhynotlem@lemmy.world 6 points 3 hours ago

Ppsshh. Not lazy enough. Create that in a script and call it "hgrep" and drop it into path.

[-] JoeyJoeJoeJr@lemmy.ml 1 points 1 hour ago

Why not just use an alias?

[-] theacharnian@lemmy.ca 1 points 3 hours ago
[-] Emerald@lemmy.world 3 points 4 hours ago* (last edited 4 hours ago)

i was doing cat ~/.bash_history | grep thing which is stupid so i started doing grep "thing" ~/.bash_history

now you're telling me i should do history | grep thing

i can't win

[-] qjkxbmwvz@startrek.website 5 points 3 hours ago

Some would call the former command cat abuse.

In short, unless you want the contents of a file printed to stdout (or multiple files concatenated), the command can probably be written without cat, instead using the filename as an argument (grep pattern file) or IO redirection (cmd < file).

Stylistics and readability are another thing though.

[-] bisby@lemmy.world 62 points 8 hours ago
load more comments (5 replies)
[-] beerclue@lemmy.world 121 points 9 hours ago
[-] lepinkainen@lemmy.world 2 points 1 hour ago

https://atuin.sh/ Does all that and a lot more, like showing if the command succeeded and which directory it was run in

[-] Mikelius@lemmy.ml 1 points 1 hour ago

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

[-] Ricaz@lemmy.dbzer0.com 7 points 5 hours ago

This but with FZF and ag

[-] banshee@lemmy.world 4 points 5 hours ago

This is what I love about Linux - always learning new things!

[-] serpineslair@lemmy.world 30 points 8 hours ago

What the fuck!? How am I only learning this now, after years of linux as daily driver?!

[-] Dave@lemmy.nz 1 points 9 minutes ago

Just checking, because I learnt to type before I worked this out, and because surely someone reading doesn't know: press tab. Bash will fill in file names from your current directory.

E.g. say you have files fred1file, fred2file, jim.

Type f then press tab, it will fill to "fred". Then press 2 and press tab again and it will fill the full "fred2file".

Have a play, it works in heaps of situations.

[-] grrgyle@slrpnk.net 4 points 4 hours ago

Congratulations! I remember where I was when I first learned it (in a noisy server room at the back of a machine shop).

Now pair it with FZF for fuzzy finding -- it's surprisingly easy to set up, just following any guide. It's insanely useful. I find myself even doing things like typing:

$ xinput --disable $(xinput --list | grep -i touchpad | grep 'id=[0-9]\+' -o | cut -d= -f2)  # Disable synaptic touchpad trackpad pointer

commands with these like comments on the ends as sort of "tags" so I can ctrl+r search for them later. Yes, I know I could just use a named function, but this is like the step just before that--before I know if I'll be issuing the same command all the time, or just for the next couple weeks. (This one was from when I was resting my notebook on my laptop.)

[-] oddlyqueer@lemmy.ml 1 points 1 hour ago

I like this; I have a lot of commands that I don't use often enough to justify an alias, but still need to rerun all the time. thanks!

[-] ch00f@lemmy.world 22 points 8 hours ago

Shit is usually a pain in the ass. The challenge is divining how much of a pain in the ass something has to be that someone else might have made a solution for it.

I didn't know you could ctrl+shift+c to copy in the terminal until a month ago when my linux n00b wife said "there has to be a better way to do this. I've been right clicking to copy for 10 years.

[-] Atherel@lemmy.dbzer0.com 15 points 7 hours ago

And ctrl + shift + v to paste, just in case

[-] TunaLobster@lemmy.world 1 points 3 hours ago

If that doesn't work, Shift + Insert.

[-] Aneb@lemmy.world 1 points 3 hours ago

Ctrl+c to copy, Ctrl+v to paste, Ctrl+z to undo last change (chain it multiple times to reverse time) hopes this helps, ctrl+tab also changes applications on macos and Linux to my knowledge. If you know anymore let's put them together

[-] Neverclear@lemmy.dbzer0.com 11 points 7 hours ago

most DE's have a thing where you can paste highlighted text using the middle mouse button

load more comments (3 replies)
load more comments (4 replies)
load more comments (1 replies)
load more comments (9 replies)
[-] AleMegadeth@eviltoast.org 3 points 4 hours ago
[-] Danitos@reddthat.com 3 points 2 hours ago

No es común ver hispanohablantes en Lemmy, ¿de qué país eres?

[-] KiwiTB@lemmy.world 38 points 9 hours ago

What, and type 'ls' again?

load more comments
view more: next ›
this post was submitted on 25 Aug 2025
718 points (100.0% liked)

linuxmemes

26923 readers
1679 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack users for any reason. This includes using blanket terms, like "every user of thing".
  • Don't get baited into back-and-forth insults. We are not animals.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn, no politics, no trolling or ragebaiting.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, <loves/tolerates/hates> systemd, and wants to interject for a moment. You can stop now.
  • 5. 🇬🇧 Language/язык/Sprache
  • This is primarily an English-speaking community. 🇬🇧🇦🇺🇺🇸
  • Comments written in other languages are allowed.
  • The substance of a post should be comprehensible for people who only speak English.
  • Titles and post bodies written in other languages will be allowed, but only as long as the above rule is observed.
  • 6. (NEW!) Regarding public figuresWe all have our opinions, and certain public figures can be divisive. Keep in mind that this is a community for memes and light-hearted fun, not for airing grievances or leveling accusations.
  • Keep discussions polite and free of disparagement.
  • We are never in possession of all of the facts. Defamatory comments will not be tolerated.
  • Discussions that get too heated will be locked and offending comments removed.
  •  

    Please report posts and comments that break these rules!


    Important: never execute code or follow advice that you don't understand or can't verify, especially here. The word of the day is credibility. This is a meme community -- even the most helpful comments might just be shitposts that can damage your system. Be aware, be smart, don't remove France.

    founded 2 years ago
    MODERATORS