What option is needed to remove a directory and its contents recursively?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 26 2025
0203

To remove a directory and its contents recursively in Bash, you need to use the -r option with the rm command.

Command Example:

rm -r directory_name

Explanation:

  • rm: The command to remove files or directories.
  • -r: Stands for "recursive," which tells the command to delete the directory and all of its contents, including subdirectories and files.

Important Note:

Be very careful when using this command, as it will permanently delete everything in the specified directory without asking for confirmation. Always double-check the directory name before executing the command.

If you have any more questions or need further assistance, feel free to ask!

0 Comments

no data
Be the first to share your comment!