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.

top 50 comments

sorted by: hot top controversial new old
[–] 193 points 7 months ago (15 children)

Reusing names of critical system directories in subdirectories in your home dir.

  • source
  • hideshow 15 child comments
  • [–] 55 points 7 months ago (4 children)

    I agree with this take, don't wanna blame the victim but there's a lesson to be learned.

  • source
  • parent
  • hideshow 4 child comments
  • load more comments (10 replies)
    [–] 114 points 7 months ago (2 children)

    HAH rookie, I once forgot the . before the ./

  • source
  • hideshow 2 child comments
  • load more comments (1 reply)
    [–] 59 points 7 months ago (5 children)

    Oof. I always type the whole path just because I have made this mistake before.

  • source
  • hideshow 5 child comments
  • [–] 57 points 7 months ago (15 children)

    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.

  • source
  • hideshow 15 child comments
  • [–] 15 points 7 months ago* (4 children)

    Just get a cli trash tool and alias it to rm. Arch wiki

  • source
  • parent
  • hideshow 4 child comments
  • [–] 23 points 7 months ago* (last edited 7 months ago) (3 children)

    That's certainly something you can do! I would personally follow the recommendation against aliasing rm though, either just using the trash tool's auto complete or a different alias altogether.

    Reason being as someone mentioned below: You don't want to give yourself a false sense of security or complacency with such a dangerous command, especially if you use multiple systems.

    I liken it to someone starting to handle weapons more carelessly because the one they have at home is "never loaded." Better safe than sorry.

    Lol we should have "rules of rm safety":

    • Assume rm is always sudo unless proven otherwise.
    • (EDIT)Finger should be off the Enter key until you are certain you are ready to delete.
    • Never point rm at something you aren't willing to permanently destroy.
    • Always be aware of your target directory, and what is recursively behind it!
  • source
  • parent
  • hideshow 3 child comments
  • load more comments (3 replies)
  • load more comments (10 replies)
    [–] 47 points 7 months ago (3 children)
  • load more comments (1 reply)
    [–] 46 points 7 months ago (10 children)

    Let he who has not wrongly deleted system critical files in Linux cast the first stone.

  • source
  • hideshow 10 child comments
  • load more comments (4 replies)
    [–] 43 points 7 months ago

    Great! Now you can enjoy that freshly assembled directory feeling, knowing that now you only have the configs in there that you need.

  • source
  • [–] 36 points 7 months ago

    β€œJust a little off the top please”

  • source
  • [–] 35 points 7 months ago (8 children)

    This is why you should setup daily snapshots of your system volumes.

    Btrfs and ZFS exist for a reason.

  • source
  • hideshow 8 child comments
  • load more comments (8 replies)
    [–] 26 points 7 months ago (5 children)

    Is there any reason to use a root account? If you had used sudo for each privilege needing command in stead it would have stopped you.

  • source
  • hideshow 5 child comments
  • load more comments (3 replies)
    [–] 24 points 7 months ago

    Whelp, time to restore the latest snapshot.

  • source
  • [–] 23 points 7 months ago

    Things like these are right of passage on Linux :)

  • source
  • [–] 22 points 7 months ago (13 children)

    So good to see that, even in 2026, Unix Haters' Handbook's part on rm is still valid. See page 59 of the pdf

  • source
  • hideshow 13 child comments
  • load more comments (13 replies)
    [–] 21 points 7 months ago (11 children)

    Your first mistake was attempting to unarchive to / in the first place. Like WTF. Why would this EVER be a sane idea?

  • source
  • hideshow 11 child comments
  • [–] [S] 12 points 7 months ago (1 child)

    I don't know if it should be a bad thing. Inside the tar archive the configs were already organized into their respective dirctories, this way with --preserve-permissions --overwrite I could just quickly add the desired versions of configs.
    Some examples of contents:

    -rw-r--r-- root/root      2201 2026-02-18 08:08 etc/pam.d/sshd
    -rw-r--r-- root/root       399 2026-02-17 23:22 etc/pam.d/sudo
    -rw-r--r-- root/root      2208 2026-02-18 09:13 etc/sysctl.conf
    drwx------ user/user         0 2026-02-17 23:28 home/user/.ssh/
    -rw------- user/user       205 2026-02-17 23:29 home/user/.ssh/authorized_keys
    drwxrwxr-x user/user         0 2026-02-18 16:30 home/user/.vnc/
    -rw-rw-r-- user/user        85 2026-02-18 15:32 home/user/.vnc/tigervnc.conf
    -rw-r--r-- root/root      3553 2026-02-18 08:04 etc/ssh/sshd_config
    

    Keeps permissions, keeps ownership, puts things where they belong (or copies from where they were), and you end up with a single file that can be stored on whatever filesystem.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 16 points 7 months ago

    Be happy that you didn't remeber the ~ and put a space between it and etcπŸ˜ƒ.

  • source
  • [–] 15 points 7 months ago (1 child)
  • [–] 15 points 7 months ago* (2 children)

    You have a backup tho', right?

    ...., right??

  • source
  • hideshow 2 child comments
  • load more comments (1 reply)
    [–] 14 points 7 months ago (1 child)

    Genuinely curious… why using root for operations like these?

  • source
  • hideshow 1 child comment
  • [–] 13 points 7 months ago
    [–] 13 points 7 months ago

    Reminds me in the t-shirt: "don't drink and root"

  • source
  • [–] 13 points 7 months ago (3 children)

    Next time:

    ls ~/etc
    rm -rv !$
    
  • source
  • hideshow 3 child comments
  • load more comments (3 replies)
    [–] 12 points 7 months ago (3 children)
  • load more comments (1 reply)
    [–] 12 points 7 months ago

    Ahh, the rites of passage!

  • source
  • [–] 12 points 7 months ago

    I am new to Linux and just getting somewhat comfortable as my daily driver, very proud of myself that I got the joke pretty quickly :)

  • source
  • [+] 10 points 7 months ago* (last edited 5 months ago) (2 children)
    load more comments (2 replies)
    [–] 10 points 7 months ago*

    I fucking hate using rm for these very reasons.

    There's another program called "trash-cli" that gives you a trash command instead of going straight to deletion.

    I'm not sure why more distros don't include it by default, or why more tutorials don't mention it.

  • source
  • [–] 9 points 7 months ago* (last edited 6 months ago)

    Yeah, same thing like with unclosed bottles, cup too close to the table edge, etc.: Accidents that can hapen, will happen.
    Better name them something else in your user dir.

    And yes, painful experience.

  • source
  • [–] 9 points 7 months ago (2 children)

    Switch from using rm to trash.

  • source
  • hideshow 2 child comments
  • load more comments (2 replies)
    load more comments
    view more: next β€Ί