On a Windows machine, when you delete a file, you get a nice little confirmation dialog (the ubiquitous "Are you sure?" popup). In fact, it probably comes up so often you don't even really notice it anymore. Unix-based operating systems were never quite so forgiving. Unix operated under the assumption that anyone logged in as root would know what they were doing, and if they wanted to delete important system files (such as 'rm -rf /bin /sbin /usr), they must have a good reason and should therefore be allowed to do so.

Linux (at least the RedHat-based distros; I'm not sure about Debian) attempted to remedy this by creating default aliases for potentially harmful commands like cp (copy), mv (move), and the abovementioned rm (remove). All three of these are aliased so that when you type in 'rm <file>', the system actually runs 'rm -i <file>'. (The -i flag stands for interactive, and prompts you for a [y] or [n] response before proceeding.) Much like the "Are you sure" dialog under Windows, right?

And just like the oft-ignored Windows dialog, there's a danger. If you use rm with the -f flag (force, to delete files without prompting, that overrides the -i "safety net".

If you're deleting files by hand, here are some safety tips to remember:
  • Log in with a normal user account for day-to-day business, not root; this can help prevent you from accidentally deleting an entire server by accident. (Yes, I did that once a very long time ago...)
  • Always back up config files before editing or performing destructive changes. (I tend to use 'cp <file> <file>.bak' or .orig)
  • Take backups! Especially hard-to-replace content like websites, saved email, or hard-to-reproduce config file modifications.