rmdir Linux Commands

What is Linux rmdir Command?

Explanation

rmdir COMMAND:

rmdir command is used to delete/remove a directory and its subdirectories.

SYNTAX :


rmdir [options..] Directory

OPTIONS:


-p Allow users to remove the directory dirname and its parent directories which become empty.

EXAMPLE:


  1. To delete/remove a directory
    rmdirtmp

    rmdir command will remove/delete the directory tmp if the directory is empty.
  2. To delete a directory tree:
    rm-irtmp

    This command recursively removes the contents of all subdirectories of the tmp directory, prompting you regarding the removal of each file, and then removes the tmp directory itself.

Ask Questions

Ask Question