rmdir(1) removes directories from the filesystem. The directory must be empty before it can be removed. The syntax is simply:
$ rmdir <directory> |
This example will remove the hejaz subdirectory in the current working directory:
$ rmdir hejaz |
If that directory does not exist, rmdir will tell you. You can also specify a full path to a directory to remove, as this example shows:
$ rmdir /tmp/hejaz |
That example will try to remove the hejaz directory inside the /tmp directory.
You can also remove a directory and all of its parent directories by passing the -p option.
$ rmdir -p /tmp/hejaz |
This will first try to remove the hejaz directory inside /tmp. If that is successful, it will try to remove /tmp. rmdir will continue this until an error is encountered or the entire tree specified is removed.