152
after every cd (media.mas.to)
top 34 comments
sorted by: hot top controversial new old
[-] wildbus8979@sh.itjust.works 12 points 2 weeks ago

Let me teach you about reverse-i-search in bash....

https://linuxvox.com/blog/ctrl-r-linux/

[-] RollForInitiative@feddit.org 6 points 2 weeks ago

Yep, thats a good one. Another one, ALT + . inputs the last argument from your last command, pressing it multiple times cycles thorough your past arguments.

[-] wildbus8979@sh.itjust.works 3 points 2 weeks ago

Nice, 30 years and I didn't know this one. I always use the $! for the last argument.

[-] toynbee@lemmy.world 2 points 2 weeks ago

I've never heard of $! but we use Macs at work. Alt+. doesn't work so I've been using $_.

[-] softwarist@programming.dev 2 points 2 weeks ago

βŒ₯+. does the trick for me on MacOS.

[-] toynbee@lemmy.world 1 points 2 weeks ago

Sorry, I should have been more clear ... When ssh'd into a remote Unix machine from a Mac, it doesn't me. I don't think I've tried locally.

[-] Inkstainthebat@pawb.social 1 points 2 weeks ago

Wow, that's a new Unicode symbol

[-] softwarist@programming.dev 1 points 2 weeks ago

You might have fun perusing the Miscellaneous Technical block (I sure did).

[-] Inkstainthebat@pawb.social 1 points 2 weeks ago

Dentistry symbols???

[-] toynbee@lemmy.world 0 points 2 weeks ago

Just as a matter of interest, I just tried this and it simply printed ≀ on the console. I'm using Terminal and Tahoe 26.2.

[-] softwarist@programming.dev 1 points 2 weeks ago

I think for Terminal.app you have to enable "Use Option as Meta key"

[-] toynbee@lemmy.world 1 points 2 weeks ago

I'll try to remember to check it out in the morning, thank you.

[-] ttyybb@lemmy.world 2 points 2 weeks ago

I don't even want to think about how much effort this has saved me.

[-] Strider@lemmy.world 1 points 2 weeks ago

Also 'cd -' and aliases... 😁

[-] pinball_wizard@lemmy.zip 6 points 2 weeks ago

This thread is full of great solutions that I know I will ignore...

[-] Anafabula@discuss.tchncs.de 4 points 2 weeks ago

I also recommend Atuin, the better shell history that works with most shells and can replace both up arrow and ctrl-r

[-] ada@piefed.blahaj.zone 3 points 2 weeks ago

In addition to ctrl-r, there is also fish! Fish does something similar to Ctrl-R, but in an easier to use way. Start typing a command, and then press the up arrow. It will cycle through your history, but only the history that includes the text you've started typing.

[-] Undearius@lemmy.ca 3 points 2 weeks ago

This can be enabled in bash by putting these two lines in ~/.inputrc

"\e[A": history-search-backward
"\e[B": history-search-forward
[-] ramenshaman@lemmy.world 2 points 2 weeks ago* (last edited 2 weeks ago)

$ sudo apt install sl

Try sl instead of ls, you'll thank me later

[-] AI_toothbrush@lemmy.zip 2 points 2 weeks ago

Very useful tip: i have ls aliased to eza which is ls with eyecandy, I have la aliased to eza -a and I have cd aliased to cd && eza which makes navigating folders very easy. I also aliased .. to cd .. for convenience. I know a lot of people are purists about the terminal but i think this is a good ballance between convenience and simplicity. Doesnt do a lot of the cursed stuff ricers like to do.

[-] Anafabula@discuss.tchncs.de 2 points 2 weeks ago

cd is a zoxide alias for me. If I need to navigate by folder content, I have yazi on y

[-] Inkstainthebat@pawb.social 0 points 2 weeks ago

How do you have cd && eza setup? With an alias the arguments only get appended to the final command so how is it cding to the correct folder?

[-] AI_toothbrush@lemmy.zip 0 points 2 weeks ago

I think i defined cd as a function for interactive shells or something. I dont remember and i dont have my computer so yeah. It should look something like this: cd() {builtin cd "$@" && eza}

[-] Inkstainthebat@pawb.social 1 points 2 weeks ago
[-] FauxLiving@lemmy.world 2 points 2 weeks ago

ls, ctrl+R

Significantly less up arrows

[-] bdonvr@thelemmy.club 2 points 2 weeks ago

Ctrl-R

Try it. Please, I beg you.

[-] irelephant@lemmy.dbzer0.com 1 points 2 weeks ago

cd - will bring you to the last directory you were in.

[-] Gyroplast@pawb.social 1 points 2 weeks ago

I like the retro text adventure charm of running a verbose ls -la after every cd. It's like entering a new room and reading its description for possible exits and items!

[-] Aneb@lemmy.world 1 points 2 weeks ago

I aliased cd | ls -la to cd so it lists the folder contents eveytime

[-] nil@piefed.ca 1 points 2 weeks ago

is yazi allowed?

[-] pedz@lemmy.ca 1 points 2 weeks ago

To be even more efficient while being lazy, try oh-my-bash. You can start typing the beginning of a command and use arrow up to cycle through only those, instead of the whole history. So if you had a very long mount command and don't want to type it again, type mount and up arrow until it can be found. Not very useful for ls -al but very appreciated on longer commands.

[-] jikt@sh.itjust.works 1 points 2 weeks ago

history | grep 'ls -la' | sed 's/^[[:space:]]*[0-9]\+[[:space:]]*//' | sh

[-] mlg@lemmy.world 1 points 2 weeks ago* (last edited 2 weeks ago)

People talking about history without mentioning the laziest answer is to use an alias, which bash usually has ll = la -la or my personal preference is ll = ls -lAh (list + Everything except . and .. + human readable file size)

[-] lmmarsano@lemmynsfw.com 1 points 2 weeks ago* (last edited 2 weeks ago)

Reposted yet again.
meme: bitches dont know bout ctrl-r
As usual, the documentation covers these answers plus much more.

this post was submitted on 25 Jan 2026
152 points (97.5% liked)

linuxmemes

29988 readers
210 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.
  • Don't come looking for advice, this is not the right community.
  • 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