Javatpoint Logo
Javatpoint Logo

rmdir Command in Linux/Unix with Examples

This command is used to delete a directory. But will not be able to delete a directory including a sub-directory. It means, a directory has to be empty to be deleted.



For example, in the image below we have deleted directory 'file1' from 'envelope' successfully. Now we want to delete 'created' directory. But it shows error as it contain 'file2'. Hence, to delete 'created' directory, first we have to delete 'file2'. Then, we will be able to delete 'created' directory.


rmdir -p

This command will delete a directory including its sub-directories all at once. In below picture, all sub-directories have been deleted with 'rmdir -p' command.


Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA