To delete or remove a directory in Linux, use the “-r” flag to the “rm” command. “r” stands for recursive.
rm -r <directory_name>
On some Linux systems, you might be prompted before each file is deleted. This means that the rm command has been aliased to “rm -i”, which turns on interactive mode. To run the original rm command and avoid the prompts, use “\rm”:
\rm -r <directory_name>
In the bash shell, just as the backslash is used to escape special characters, it is also used to escape aliases.
Be careful to double check the directory name you provide, and be extra careful when using wildcards. There have been many stories of grief because of users ending up deleting important files and folders recursively.