# How to delete a folder with contents on ubuntu  cli

To delete a folder and its contents in Ubuntu 23.04 using the command line interface (CLI), you can use the `rm` command with the `-r` (recursive) option. Be very careful when using the `rm` command, as it will permanently delete files and folders.

Here's the basic syntax:

<div class="bg-black rounded-md" id="bkmrk-rm--r-%2Fpath%2Fto%2Fyour%2F"><div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md">  
</div><div class="p-4 overflow-y-auto">`<span class="hljs-built_in">rm</span> -r /path/to/your/folder`</div></div>Replace "/path/to/your/folder" with the actual path to the folder you want to delete.

For example, if you want to delete a folder named "myfolder" located in your home directory, you can use the following command:

<div class="bg-black rounded-md" id="bkmrk-rm--r-%7E%2Fmyfolder"><div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md">  
</div><div class="p-4 overflow-y-auto">`<span class="hljs-built_in">rm</span> -r ~/myfolder`</div></div>Again, be cautious when using the `rm -r` command, as it will not prompt you for confirmation, and the deletion is irreversible. Double-check the path to the folder before running the command to avoid accidental data loss.

If you want to confirm each file deletion, you can use the `-i` option:

<div class="bg-black rounded-md" id="bkmrk-rm--ri-%2Fpath%2Fto%2Fyour"><div class="flex items-center relative text-gray-200 bg-gray-800 dark:bg-token-surface-primary px-4 py-2 text-xs font-sans justify-between rounded-t-md">  
</div><div class="p-4 overflow-y-auto">`<span class="hljs-built_in">rm</span> -ri /path/to/your/folder`</div></div>This will prompt you for confirmation before deleting each file and subdirectory.

Always exercise caution when using the `rm` command, especially with the `-r` option, to avoid unintentional data loss.