home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 23.2 rm and Its Dangers Chapter 23
Removing Files
Next: 23.4 Answer "Yes" or "No" Forever with yes
 

23.3 Tricks for Making rm Safer

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 ).

- ML


Previous: 23.2 rm and Its Dangers UNIX Power Tools Next: 23.4 Answer "Yes" or "No" Forever with yes
23.2 rm and Its Dangers Book Index 23.4 Answer "Yes" or "No" Forever with yes

The UNIX CD Bookshelf Navigation The UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System