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.

you are viewing a single comment's thread
view the rest of the comments
[–] 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
  • [–] 15 points 7 months ago (4 children)

    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 ~/etc ... rm -rv !$
    3. Add the commands to a simple script and use variables to remove the danger of a command line.
  • source
  • parent
  • hideshow 4 child comments
  • [–] 3 points 7 months ago (2 children)

    Thankfully I don't hit the space bar randomly (yet) but btrfs snapshotting has saved the day for other mishaps

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 7 months ago (1 child)

    I think the bigger point is that if you type the entire path, you are obviously typing more characters, which gives more opportunities for typos, whatever they may be.

    It's far safer to find ways to type less. Less typing, fewer typos. As long as you can do it safely.

  • source
  • parent
  • hideshow 1 child comment