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.

  • BillyClark@piefed.social
    link
    fedilink
    English
    arrow-up
    3
    ·
    4 hours ago

    That doesn’t protect you from typos.

    rm -rv /home/schmuck /etc

    “Whoops, I accidentally added a space.”

    I have three ways around this:

    1. ls ~/etc … <press up arrow, replace ls with rm -rv>
    2. ls ~/etcrm -rv !$
    3. Add the commands to a simple script and use variables to remove the danger of a command line.