What is the command to delete a directory in Linux?

To remove a directory and its contents in Linux, you can use the `rm` command with appropriate options. Here are some commonly used options:

`-r` : recursively delete the directory and all its contents.

-f: Delete forcefully without confirmation.

– `-i` option: interactive deletion, will prompt for confirmation.

The following is an example of a command for deleting a directory:

rm -r 目录名

Please note that the `rm` command is very powerful and its actions are irreversible. Therefore, be cautious when using this command and make sure the directory you are deleting is correct.

bannerAds