infoLinux

Removing Directory Using rmdir Command Tool in Linux

rmdir command is use to delete a directory. Without any options for this tool and you won’t be able to delete a directory. Which has sub-directories. That means, a directory has to be empty to be delete.

Syntax of rmdir Command Tool:

$ rmdir <dir name>

Like Example:

$ rmdir myfolder1

If you want to delete a directory which has sub directories, you can use the rm tool.

Like example:

$ rm -r ~/Documents

This command deletes all files directories inside the ~/Documents folder. The -r option signifies to remove the contents recursively.

Leave a Reply

Your email address will not be published. Required fields are marked *