Contact us

Print

Using rm

The “rm” command is used to delete files or directories. You are going to use “rm” to delete some of the files you created in the earlier exercises.

To use rm


1. While still in the folder1 directory, delete the file standard_err. Type “y” at the
confirmation prompt.


[root@localhost folder1]# rm standard_err

rm: remove `standard_err'? y


2. Delete the “standard_out” file. To prevent being prompted for confirmation before
deleting a file use the “–f “ option with the rm command.


[root@localhost folder1]# rm -f standard_out


3. Change back to your home directory (/root) and delete the “folder2” directory.
To use “rm” to delete a folder you need to use the “–r” switch:


[root@localhost root]# rm -r folder2

rm: descend into directory `folder2'? y
rm: remove `folder2/temp_file21'? y
rm: remove `folder2/temp_file22'? y
rm: remove directory `folder2'? y


You were again prompted to confirm the removal of each file in the directory and the directory itself.
What option will you use with the “ rm –r ” command to prevent this?


Created by: system. Last Modification: Wednesday 26 of November, 2008 19:35:51 EST by wale.

...