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

Tired of the privacy invasion of browsers? Worried about the risk of seeing ads everywhere? Give the Brave Browser a try. All Chrome extensions are compatible. None of the telemetry. Auto-blocks ads and still support content creators like me.

Download the Brave browser now »

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.