next up previous contents
Next: Changing File Permission Modes Up: Basic File Commands Previous: Moving/Renaming Files

Removing Files

To remove a file use the rm command:

rm [options] filename

To remove a file you need only have write permission on the directory that contains the file, write permission on the file itself is not necessary. If you wish to remove a file that has write protection, a warning message asking you to confirm deletion will appear, but you are allowed to delete the file. To delete a file that exists in a write-protected directory, you must change the protection mode of the directory first.

To prevent accidental file removal, the -i option should be used. This will cause rm to ask you if you really wish to delete the file. Remember, once a file is removed, it can not be recovered. You may wish to alias rm to 'rm -i ' and cp to 'cp -i ' and mv to 'mv -i '. More information on the alias command can be found in the section titles ''Unix C Shell Interface'' under Shell Commands.



World Wide Web Administrator
1/5/1999