• Fillicia@sh.itjust.works
      link
      fedilink
      arrow-up
      36
      ·
      26 days 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”)

      • Aurenkin@sh.itjust.works
        link
        fedilink
        arrow-up
        20
        ·
        edit-2
        26 days ago

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

      • vvv@programming.dev
        link
        fedilink
        arrow-up
        8
        ·
        26 days ago

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

      • Tetsuo@jlai.lu
        link
        fedilink
        arrow-up
        6
        ·
        26 days 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
        arrow-up
        5
        ·
        26 days 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
          arrow-up
          4
          ·
          26 days 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.

      • DefederateLemmyMl@feddit.nl
        link
        fedilink
        English
        arrow-up
        1
        ·
        21 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, …