How to use the rm command to delete files and directories recursively in linux/unix.
rm -r dirName
rm -rf dirName
In the following example, recursively delete data folder:
➜ rm -r a
First clear all subdirectories, including their subdirectories and files, and then delete the data directory.
If the directory contains write-protected files, the user will be prompted to delete, unless the -f (force) option is used in the command line:
➜ rm -rf a