To remove a non-empty directory, you can use the rm command with the -r (recursive) option. The syntax is as follows:
rm -r directory_name
Example:
If you have a directory named non_empty_dir that you want to remove, you would run:
rm -r non_empty_dir
Important Note:
- Be cautious when using this command, as it will delete the directory and all of its contents permanently. If you want to be prompted before each deletion, you can add the
-ioption:
rm -ri non_empty_dir
This will ask for confirmation before deleting each file and subdirectory.
