rm delete recursively in linux/unix
August 20, 2020
How to use the rm command to delete files and directories recursively in linux/unix.
Syntax
rm -r dirName
rm -rf dirName
Examples
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