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

Oh Dear monitors your entire site, not just the homepage. We crawl and search for broken pages and mixed content, send alerts when your site is down and notify you on expiring SSL certificates.

Start your free 10 day trial! »

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.