Files and folders
The rmdir command
Deletes folders, but only if they are empty. It is the safe option.
Syntax
rmdir <carpeta>...Most useful options
-pDeletes the folder and its parents if they become emptyCopy-ready examples
$ mkdir vacia && rmdir vaciaDelete an empty folder$ mkdir uno && mkdir dos && rmdir uno dosSeveral at onceYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- If there is something inside, it refuses and warns you.
FAQ
Why does it say it is not empty?
Because it contains files: delete them first or use rm -r.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course