rm
Linux Commands - Managing Files and Text

rm

his will remove or delete files and directories. You must have permission to write to the directory that contains a file if you want to delete that file.


Example:


rm mytext


-d remove linked directories

-i prompt before removing

-f force delete without any prompting

-r,-R recursive removal, all files, directories and sub-directories


An often used option is the -R or recursive removal. This will remove all directories and the sub contents. You will probably want to use the -f option as well so you do not need to answer yes to each file and directory that is going to be used. This command can be dangerous if you are not careful.


rm -fR tech/


Notice two options are used here to force the removal and to remove a directory and its contents.



The -i option is a good choice if there is some question concerning if the file should be removed or not because the user will be asked to verify each removal.