• @Fillicia@sh.itjust.works
      link
      fedilink
      361 month ago

      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”)

      • @vvv@programming.dev
        link
        fedilink
        81 month ago

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

      • @Tetsuo@jlai.lu
        link
        fedilink
        61 month 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
        link
        fedilink
        51 month ago

        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
          link
          fedilink
          41 month 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.

      • fmstratA
        link
        English
        41 month ago

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

      • DefederateLemmyMl
        link
        fedilink
        English
        128 days 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, …

  • There is an advantage to this approach though: fewer errors. You’re plucking a known working command from a list instead of manually typing a (possibly) broken version of it. Worse yet is when it’s a command where typematic mistakes cause unintended side effects like data loss. So, mashing up 100 times can be pretty smart, especially if you’re not a great typist.

  • @xmunk@sh.itjust.works
    link
    fedilink
    71 month ago

    Sorry, do you not keep sql scratch files around?

    If deving on the cli name and save to separate files your reusable queries…

  • @Varyk@sh.itjust.works
    link
    fedilink
    41 month ago

    I definitely do this with terminal commands, because I’m not hunting for whatever the specific command line to animate my gif wallpaper is.

      • @Varyk@sh.itjust.works
        link
        fedilink
        10
        edit-2
        1 month ago

        HOLY SHIT.

        hahahaha, thank you. oh my gosh.

        This is the most significant terminal hotkey I’ve learned in months.

        ♪⁠┌⁠|⁠∵⁠|⁠┘⁠♪

    • fuzzy_feeling
      link
      fedilink
      21 month ago

      been there, done that.

      then i heard about cli snippet manager. now i use qownnotes snippet manager qc. or you might try pet.

      • @Varyk@sh.itjust.works
        link
        fedilink
        11 month ago

        did you know about the ctrl+r command so you can search logged commands by keyword!

        magic lobster party told me about it and it’s amazing!

        I had no idea that was a function until now.

  • Billygoat
    link
    fedilink
    English
    41 month ago

    Can’t find the info atm but if you setup inputrc to use vim controls you can use the vim search in psql.

  • @hex@programming.dev
    link
    fedilink
    31 month ago

    At work, was recently working on a script that alters the repo significantly. Every time I tested the script, I used the up arrow to get the git clean and git checkout HEAD -- files commands to reset the repo. I must’ve used those 100+ times.