Here's a summary of ways to protect yourself from accidentally
deleting files:
-
Use
rm -i
, possibly as an alias (articles
21.11
possibly
and
23.7
).
-
Make
rm -i
less painful (article
23.6
).
-
Write a "delete" script that moves "deleted" files to a temporary
directory (article
23.8
).
-
tcsh
(
8.3
)
has an
rmstar
variable that makes the shell ask for confirmation
when you type something like
rm *
.
-
Use a more comprehensive "safe delete" program, like the one described
in article
23.9
.
-
Use revision control (article
20.12
).
-
Make your own backups, as explained in article
20.2
.
-
Prevent deletion (or renaming or creating) of files by making the
directory
(not necessarily the files in it!) unwritable.
Article
22.2
.
If you want to delete with wild abandon, use
rm -f
(article
23.10
).