Table of Contents
In the Linux world, there’s a saying that every beginner gets solemnly warned about by their seniors: “Before you do anything, make sure you know what directory you’re in.” And the star behind this saying is that command that people both love and fear—rm -rf.
rm is delete, -r is recursive, -f is “don’t ask me, just delete it.” Put those three letters together, and you get a grenade with no safety pin.
Those Real-Life Disasters
The most famous victim is probably Pixar in 1998. At the time, Toy Story 2 was still in production, and an engineer accidentally triggered a delete command while cleaning up files. Animation files started disappearing one after another at a visible rate, including the model for the protagonist Woody—the very heart of the film. Just as the team was on the verge of collapse, technical director Galyn Susman remembered she had a backup on her home office computer, which saved the movie. It’s said that backup came from a synced copy she’d made “so she could get some work done while wrangling the kids at home.”
Even worse than the animation case was GitLab in 2017. An operations engineer, while fixing a database primary-replica synchronization issue, accidentally ran the delete command on the primary database instead of the problematic replica. As a result, about 6 hours’ worth of data was deleted from 300GB of production data, and they barely recovered it using a backup that happened to be “exactly one week old”—that incident later became a classic textbook case in DevOps circles for “you can never have too many backups.”
Another famous “suicide-style” incident came from the gaming platform Steam. In 2015, a cleanup command in an installation script was written as:
rm -rf "$STEAMROOT/"*Looks fine, right? The problem is: if the $STEAMROOT variable happens to be empty, this command expands to:
rm -rf /*In plain English, that means “delete everything under the root directory.” Fortunately, this bug was only triggered on a very small number of Linux distributions, and the script required root privileges at the time, so it didn’t cause a major disaster—but it was enough to send chills down the spine of anyone who writes scripts.
Why “Small Mistakes” Always Come with Heavy Costs
These incidents share one thing in common: the command itself wasn’t written wrong—what was wrong was the environment in which it was executed—an extra space, an empty variable, a mistyped hostname. And rm -rf is terrifying because it deletes fast and thoroughly, leaving almost no chance to undo.
So veterans’ “life-saving habits” tend to be quite simple:
#Before deleting, run pwd first to confirm where you arepwd
#Before deleting a critical path, run ls first to check whether this is the one you want to deletels -l /data/production
#Use a "dry run" instead of executing directly: echo it out first, and once confirmed, remove the echoecho rm -rf /data/production/oldThe safest move is to replace rm with “move to trash,” or simply rely on version control + regular backups as a fallback. After all, even Pixar and GitLab have stumbled, so no one dares claim their hands will always be steady.
Conclusion
rm -rf itself isn’t wrong—it’s just a tool designed to be extremely efficient. What truly deserves respect is the destructive power that comes from combining “automation + high privileges.” Next time you’re about to hit Enter, take an extra moment to look at the directory before your cursor—that one glance could be worth 300GB.
References
- GitLab.com Database Incident Postmortem (2017-02-01) — The official postmortem, documenting the full process of accidentally deleting the primary database
- The Story of Toy Story 2 Being Accidentally Deleted and Rescued — The famous tale of Pixar’s animation files nearly being lost
- Steam’s rm -rf / Vulnerability Announcement (2015) — Discussion of the bug where an empty variable led to deleting the root directory