• papertowels@lemmy.one
    link
    fedilink
    arrow-up
    10
    ·
    2 months ago

    sudo !! to rerun last command as sudo.

    history can be paired with !5 to run the fifth command listed in history.

    • Kelly Aster 🏳️‍⚧️@lemmy.world
      link
      fedilink
      English
      arrow-up
      2
      ·
      2 months ago

      @[email protected] I’ve been working in the bash shell since 1993 and did not know sudo !! was a thing. Good lord, I no longer have to press up, press crtl-left a bunch of times, then type sudo enter space anymore. And I can give it an easy-to-remember alias like ‘resu’ or ‘redo’! Ahahaha, this changes everything! Thank you!!