To remove a non-empty directory in Unix/Linux, you can use the rm
command with the -r
option. This option tells rm
to remove the specified directory and all of its contents, including subdirectories and files.
Here’s the syntax for using rm
to remove a non-empty directory:
rm -r directory_name
For example, if you wanted to remove a directory called “example_dir”, you would use the following command:
rm -r example_dir
Keep in mind that this command is irreversible, so use it with caution. It’s always a good idea to double-check the directory name before using rm
to make sure you’re deleting the correct directory.