ADVERTISEMENT

Linux Commands ❯ rmdir

rmdir

Remove the DIRECTORY(ies), if they are empty.
syntax:

rmdir [OPTION]... DIRECTORY...
  • rmdir my_dir1
    delete empty directory called my_dir1. it will throw an error if the directory not empty
  • rmdir my_dir1 my_dir2 my_dir3
    delete my_dir1, my_dir2 and my_dir3 at once
  • rmdir -p my_dir1/my_dir2/my_dir3
    delete my_dir3 first, my_dir2 on second and then my_dir1
  • rmdir -v my_dir1
    delete empty directory called my_dir1. it will throw an error if the directory not empty or else the directory will be removed with a message