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.

  • MonkeMischief@lemmy.today
    link
    fedilink
    arrow-up
    18
    ·
    3 hours ago

    OOOOOOOOOOOF!!

    One trick I use, because I’m SUPER paranoid about this, is to mv things I intend to delete to /tmp, or make /tmp/trash or something.

    That way, I can move it back if I have a “WHAT HAVE I DONE!?” moment, or it just deletes itself upon reboot.

      • I Cast Fist@programming.dev
        link
        fedilink
        arrow-up
        1
        ·
        11 minutes ago

        After being bitten by rm a few times, the impulse rises to alias the rm command so that it does an rm -i” or, better yet, to replace the rm command with a program that moves the files to be deleted to a special hidden directory, such as ~/.deleted. These tricks lull innocent users into a false sense of security.