Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

GNU rm has exactly that built-in:

    $ rm -rf /
    rm: it is dangerous to operate recursively on ‘/’
    rm: use --no-preserve-root to override this failsafe


Go on, fire up a cheap VPS somewhere like DigitalOcean and run "rm -rf / --no-preserve-root". Maybe I am too easily amused but as a long-time Linux user on the desktop this is one of those things I always wanted to try. After it runs, you can't even shut down or run anything else, you just kill the SSH session.


The problem with this kind of safety nets is that it may break scripts that rely on this to work.


How many daily-use scripts do you suppose intentionally run `rm -rf /`? Cost-benefit for common use seams clearly in favour of adding a failsafe.


It's a good thing you can fix the script by adding that flag into them.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: