How to remove a non-empty directory?

QuestionsQuestions8 SkillsProBasic Files OperationsAug, 31 2025
0138

To remove a non-empty directory, you can use the following command:

rm -rf directory-name
  • rm: The command to remove files or directories.
  • -r: This option stands for "recursive," allowing the command to remove the directory and all its contents.
  • -f: This option stands for "force," which suppresses prompts and errors, allowing the command to execute without confirmation.

Replace directory-name with the name of the directory you want to remove.

Warning: This command will permanently delete the directory and all its contents, so use it with caution.

0 Comments

no data
Be the first to share your comment!