this post was submitted on 01 Jul 2023
690 points (97.5% liked)

linuxmemes

22802 readers
336 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.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 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. Even if you watch it on a Linux machine.
  • 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.
  • Β 

    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
     
    top 50 comments
    sorted by: hot top controversial new old
    [–] not_neno@lemmy.world 76 points 2 years ago (4 children)
    [–] jrandiny@lemmy.world 10 points 2 years ago (2 children)

    You can also install https://github.com/dvorka/hstr to supercharge your ctrl+r

    [–] Skuldugery@feddit.de 4 points 2 years ago

    I can recommend fzf since it also supports searching the current directory

    load more comments (1 replies)
    [–] Doolbs@lemmy.world 10 points 2 years ago (2 children)

    Holy Crap. I have gotten into the arrow up mode. Then I went to History.

    But, but, but ctrl + r. Holy crap.

    Thank you kind sir or madam.

    [–] nous@programming.dev 10 points 2 years ago (1 children)

    If you enjoy that, then let me introduce you you fzf - a fuzzy finder that has support for replacing ctrl + r in shells with fuzzy matching. Among other uses.

    https://github.com/junegunn/fzf#key-bindings-for-command-line

    load more comments (1 replies)
    [–] not_neno@lemmy.world 4 points 2 years ago (1 children)

    Man I over use it at work - even when sitting in front of a pwsh prompt

    load more comments (1 replies)
    [–] frank@lemmy.world 5 points 2 years ago (2 children)

    Is there a MacOS versiΓ³n of this? Asking for a friend.

    [–] nous@programming.dev 8 points 2 years ago

    It's the same, ctrl + r. It is a bash/shell thing so works on any os that uses bash or similar shells. Note, it is not the command key, but ctrl, unlike a lot of other shortcuts on macos.

    load more comments (1 replies)
    [–] Linssiili@sopuli.xyz 2 points 2 years ago

    Fish gang arise (no need for ctrl+r, just press up)

    [–] RomanRoy@lemmy.world 39 points 2 years ago (1 children)

    Ctrl R > start typing

    You're welcome to have your life changed

    load more comments (1 replies)
    [–] kentaromiura@feddit.it 26 points 2 years ago

    Finally the ls command!

    [–] MinusPi@lemmy.fmhy.ml 19 points 2 years ago (1 children)

    Up up up up up up up up up oh wait down

    [–] luka@lemmy.world 5 points 2 years ago (1 children)
    [–] FarLine99@lemm.ee 3 points 2 years ago
    [–] jcb2016@lemmy.world 15 points 2 years ago (1 children)

    ctrl + r then enter phrase

    [–] jg1i@lemmy.world 14 points 2 years ago (2 children)
    load more comments (2 replies)
    [–] rln@lemmy.world 9 points 2 years ago

    Bro, do you even ^R ?

    [–] gnuplusmatt@aussie.zone 8 points 2 years ago (1 children)

    ~/.bash_history is where my documentation lives

    [–] b3nsn0w@pricefield.org 3 points 2 years ago

    yeah, the other day i was supposed to remove a restriction from a router that was some custom thing built on a raspberry pi. i logged in, started messing around, trying to figure out the system, and of course i looked at bash_history because why not, i'm unfamiliar with the setup so it seemed like a good place to start. up until i found some commands editing it. so i'm like

    $ export HISTFILE=/dev/null # alright, two can play this game
    

    it ended up being a simply cron job that runs a script that starts and stops hostapd every once in a while. i didn't disable the cron job, i just commented out a critical line from the stop script. happy debugging to the sysadmin, lol

    [–] drcouzelis@lemmy.zip 8 points 2 years ago (2 children)

    Time to up your game with Ctrl + R reverse search! πŸ€“

    load more comments (2 replies)
    [–] norgur@discuss.tchncs.de 8 points 2 years ago (1 children)

    cat /var/www/vhosts.d/l[tab]o[tab]l[tab]a[tab]...

    [–] 0x4E4F@sh.itjust.works 4 points 2 years ago (1 children)
    [–] norgur@discuss.tchncs.de 7 points 2 years ago (1 children)

    cat /var/www/vhosts.d/lolanotherfilehasthesamenamebutwith1.conf

    load more comments (1 replies)
    [–] kenoh@lemm.ee 8 points 2 years ago

    ctrl+p gang RISE UP

    [–] someacnt_@lemmy.world 6 points 2 years ago (1 children)

    Woah. Quality of meme in this site amazes me.

    [–] 0x4E4F@sh.itjust.works 3 points 2 years ago (1 children)

    It's more or less like on reddit, but less users.

    [–] raspberry_confetti@sh.itjust.works 9 points 2 years ago (1 children)
    [–] unstable_confusion@lemmy.fmhy.ml 7 points 2 years ago* (last edited 2 years ago)

    It's more or fewer like on Reddit, but with less users.

    [–] CthulhuDreamer@lemmy.world 5 points 2 years ago (1 children)

    Or history | grep {command}

    load more comments (1 replies)
    [–] atx_aquarian@lemmy.world 4 points 2 years ago (4 children)

    Y'all know about ctrl-r to search history, right? I went for so many years without even thinking to look for something better than up-arrow, so I have to mention it.

    [–] amanwithausername@vlemmy.net 6 points 2 years ago (5 children)

    Wait until they learn that you can ctrl+u when you mistyped your password in sudo instead of spamming backspace...

    load more comments (5 replies)
    load more comments (3 replies)
    [–] snake@lemmy.world 4 points 2 years ago (3 children)

    cat .bash_history | grep keyword

    But yeah pretty much.

    [–] 1337@lemmy.world 5 points 2 years ago

    Why not just history | grep keyword then? Works in any directory.

    load more comments (2 replies)
    [–] jogurt@lemmy.world 4 points 2 years ago (2 children)

    I usually do ctrl+r but with zsh I can type the beginning of the command and press up and it will search that way too.

    load more comments (2 replies)
    [–] imnotneo@lemmy.world 4 points 2 years ago

    ah there's my password...

    [–] CriticalMiss@lemmy.world 4 points 2 years ago (4 children)
    1. vim ~/.inputrc
    2. Paste the following:

    "\e[A": history-search-backward "\e[B": history-search-forward

    Thank me later

    load more comments (4 replies)
    [–] anthimatter@lemmy.world 4 points 2 years ago

    Guilty. Even knowing better ways laziness wins. Skyrim console too.

    [–] corvett@lemmy.world 4 points 2 years ago

    history | grep term

    [–] azvasKvklenko@sh.itjust.works 3 points 2 years ago (2 children)

    And the command is something like ls -l πŸ‘

    load more comments (2 replies)
    [–] knobbysideup@lemm.ee 3 points 2 years ago

    Since this post triggered hidden gems: ^old^new will substitute old with new from the last command and execute.

    [–] polite_cat@lemmy.world 3 points 2 years ago (3 children)

    Ctrl+R together with fzf makes this obsolete

    load more comments (3 replies)
    [–] c0mbatbag3l@lemmy.world 3 points 2 years ago

    Me when configuring a switch.

    [–] CheemsBread@lemmy.world 3 points 2 years ago

    esc + k for me! (vi for life)

    [–] veng@lemmy.world 2 points 2 years ago* (last edited 2 years ago) (1 children)

    history | grep {some part of command}

    Much more useful for going further back, even without grep.

    [–] mazkarth@lemmy.world 2 points 2 years ago

    As some one who SSH's from a phone to run Docker containers and will be moving the container volumes to a different location, I thank you for this lovely command.

    [–] lhx@lemmy.world 2 points 2 years ago

    I feel this in my soul. Or when you realize you're hitting up up up up to find something trivial like ls and it would have been more efficient to just type ls. LOL.

    [–] bappity@lemmy.world 2 points 2 years ago

    no I don't want to write the single word command out again I'd rather go up the history with more keypresses

    load more comments
    view more: next β€Ί