# rmdir

## Introduction

This command is used to remove the DIRECTORY(ies), if they are empty.

***

## Syntax

`rmdir [OPTION]... DIRECTORY...`

***

## Important Flags

| Flag                         | Description                                                                |
| ---------------------------- | -------------------------------------------------------------------------- |
| `--ignore-fail-on-non-empty` | Doesn't show an error message when trying to remove a non-empty directory. |
| `-p`                         | Removes the directory along with its parent in the hierarchy.              |
| `-v`                         | Provides a verbose output.                                                 |
| `--help`                     | Displays help text.                                                        |
| `--version`                  | Displays the command version.                                              |

***

## Examples

<table><thead><tr><th>Command</th><th>Description</th></tr></thead><tbody><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir mydir1 mydir2 mydir3 .....
</code></pre></td><td>Removes multiple directories using the basic rmdir command.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir LINUX INFO DETAIL
</code></pre></td><td>Removes the LINUX, INFO, and DETAIL directories.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -p mydir1/mydir2/mydir3/...../mydirN
</code></pre></td><td>Deletes a directory, including all subdirectories.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -p LINUX/mydir1/mydir2/mydir3
</code></pre></td><td>Deletes the LINUX directory, including all its ancestors.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -p -v Example/Test
</code></pre></td><td>Removes a subdirectory and its hierarchical parent and lists each step of the process.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -v dir1 dir2 dir3
</code></pre></td><td>Displays a message after removing the specified directories.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -v LINUX INFO DETAIL
</code></pre></td><td>Deletes the LINUX, INFO, and DETAIL directories and displays a message after each removal.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -v LINUX*
</code></pre></td><td>Deletes all directories that contain "LINUX" in their name and displays a message after each removal.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -v Example/Test Example
</code></pre></td><td>Removes multiple directories in reverse order of hierarchy and lists each step of the process.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir -v Example*
</code></pre></td><td>Removes multiple directories with similar names using wildcards and lists each step of the process.</td></tr><tr><td><pre class="language-bash" data-overflow="wrap"><code class="lang-bash">rmdir --ignore-fail-on-non-empty LINUX
</code></pre></td><td>Ignores errors due to non-empty directories when attempting to remove the LINUX directory.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://thamizhiniyancs.gitbook.io/cheatsheets/linux/manipulating-files-directories/rmdir.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
