Linux command: rmdir

A quick guide to the rmdir command, used to delete folders

Just like you can create a folder usingmkdir, You can delete the folder usingrmdir:

mkdir fruits
rmdir fruits

You can also delete multiple folders at once:

mkdir fruits cars
rmdir fruits cars

The folder you delete must be empty.

To delete a folder containing files, we will use the more generalrmUse the following commands to delete files and folders-rfOptions:

rm -rf fruits cars

Please be careful, because this command will not ask you for confirmation, it will immediately delete everything you want to delete.

NoboxWhen deleting files from the command line, it can be difficult to recover the lost files.

This command can be used in Linux, macOS, WSL and wherever you have a UNIX environment

Download mine for freeLinux Command Manual


More cli tutorials: