Here's a summary of ways
to protect yourself from accidentally
Use rm -i, possibly as an alias (Section 14.8).
Make rm -i less painful (Section 14.7).
Write a "delete" script that moves
"deleted" files to a temporary
directory (Section 14.9).
tcsh has an rmstar
variable that makes the shell ask for confirmation when you type
something like rm *. In zsh,
this protection is automatic unless you set the
RM_STAR_SILENT shell option to stop it.
Use revision control (Section 39.4).
Make your own
explained in Section 38.3.
deletion (or renaming or creating) of files by making the
directory (not necessarily the files in it!)
unwritable (Section 50.2).
If you want to delete with wild abandon, use rm
-f (Section 14.10).