Preventing Data Loss (File Deletion)
ITS encourages you to take measures to prevent loss of data. These measures include using the
-i option with the
cp commands. Also, you should create backup
disks of important files. Both of these measures will help prevent accidental loss of data.
If your account resides on an ITS-owned machine, and your
UserLevel is set to
mv commands are aliased to include
-i by default. This is true only for ITS-owned machines, and not UNIX in general.
This file will tell you how to set up aliases so that the commands listed above will operate in interactive mode. You can check to see what aliases you are using by typing:
If the list of aliases includes something which looks like:
rm rm -i
then you already have an alias set up to force the command to ask you for permission before deleting.
For all intents and purposes, when you delete a file with
it is gone. The system actually forgets which blocks of data, scattered
around the disk, comprised your file. The only way to retrieve such a
file is by requesting a UNIX restoral. Please see the ITS Operational Procedures for more information.
rm with the
rm -i <filename>
where <filename> is the name of the file(s) that you would
like to delete. This is the interactive option. You must confirm the
y for each file or
n to skip the file. E.g:
% rm -i prog*.c
rm: remove prog1.c? y
rm: remove prog2.c? n
rm: remove prog3.c? y
rm: remove prog4.c? n
You can redefine the
rm command to use this option with the command:
alias rm 'rm -i'
With the above alias, whenever you use
rm, it will actually execute in your
You can also use the interactive option with other commands like
mv. Whenever the
use of one of these programs would cause an existing file to be overwritten, then the
-i option will cause it to prompt you
If you have the above alias definition in your
.cshrc file you can override it either by typing in the full pathname of
or by using
unalias to get rid of the
rm alias for that current
Note: When you log in again, the
rm alias will once again be defined as it
appears in your .cshrc file.
February 03, 2011