What happens when you run “rm -fr /” on a Linux machine?

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, April 12, 2016

Follow me on Twitter as @mattiasgeniar

I made a quick video to show what exactly happens when you type rm -fr / on a Linux machine.

Spoiler: nothing, actually. At least, not until you use the --no-preserve-root flag.

Big, very big, warning: do. not. run. these. commands. on. your .servers. Some distributions prevent you from running the ‘rm’, but older distributions will happily delete all your files.

This was a nice test in screen capture and basic video editing, there isn’t much to it otherwise.

Sidenote: while making this video, I learned the hard way that Vagrant auto-mounts its project directories. And when you tell rm to be recursive, it’ll be recursive. Woops..



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.