I accidentally untarred archive intended to be extracted in root directory, which among others included some files for /etc directory.
I went on to rm -rv ~/etc, but I quickly typed rm -rv /etc instead, and hit enter, while using a root account.

  • stinerman@feddit.online
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 days ago

    I’ve literally done rm -rf / while root. I thought I was elsewhere and did rm -rf . and I was in the top level directory. When it took way longer than I expected, I hit CTRL+C about 10 times and looked at the damage. Oops.

    Luckily it didn’t get to /home, but it did wipe out /bin and /etc. I had to rebuild the OS. I learned.

    • Zikeji@programming.dev
      link
      fedilink
      English
      arrow-up
      5
      ·
      edit-2
      4 days ago

      Half a year ago I accidentally git cloned to a folder named ~, so naturally I did rm -rf ~.

      Mistakes were made. Fortunately I backup my ~ so it was just annoying.

    • palordrolap@fedia.io
      link
      fedilink
      arrow-up
      3
      ·
      4 days ago

      If I’m about to run an rm with a slash in it, alarm bells go off in my head. I prefer to cd to the parent and then rm whatever without slashes in the name.

      That didn’t save me the other day when I accidentally put a space before an asterisk, but thankfully that wasn’t in a place that was overly important.

      Gotta retrain myself to look out for extra nothing now.