Windows
Linux
File Management
File System
Windows rd / rmdir equivalent in Linux
Deletes empty directories (rmdir) or directories with all their contents (rm -r).
Windows
→
rd / rmdir
Linux equivalents
rmdir / rm -r
rmdir / rm -r
rmdir / rm -r
Overview
What this command does
Deletes empty directories (rmdir) or directories with all their contents (rm -r).
Migration tip:
rmdir only removes empty directories. To remove a directory and everything inside it use rm -r. Add -v to see each file being deleted.Practical tasks
Common use cases
Remove directories
Deletes empty directories (rmdir) or directories with all their contents (rm -r).
rmdir dirname
Remove empty directory
rmdir -p a/b/c
Remove nested empty dirs
rm -r dirname
Remove directory and all contents
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
rmdir emptydir
rm -r MyFolder
rm -rv MyFolder
Walkthrough
Examples with explanations
# Windows: rd /s /q MyFolder
# Remove empty directory:
rmdir emptydir
# Remove directory and everything in it:
rm -r MyFolder
# Verbose — see what's being deleted:
rm -rv MyFolder
Reference
Common options and variations
| Command or option | Use |
|---|---|
rmdir dirname | Remove empty directory |
rmdir -p a/b/c | Remove nested empty dirs |
rm -r dirname | Remove directory and all contents |
rm -rf dirname | Force remove (no prompts) |
rm -rv dirname | Remove verbosely (see each file) |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | rmdir / rm -r |
Same command on this distribution. |
| Fedora | same command | rmdir / rm -r |
Same command on this distribution. |
| Arch | same command | rmdir / rm -r |
Same command on this distribution. |
Important
What to watch out for
rm -rf with a wrong path can delete critical files. Double-check the path — there is no undo.
Keep learning