← All commands
Topic hub File Management
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
Debian/Ubuntu same command
rmdir / rm -r
Fedora same command
rmdir / rm -r
Arch same command
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 optionUse
rmdir dirnameRemove empty directory
rmdir -p a/b/cRemove nested empty dirs
rm -r dirnameRemove directory and all contents
rm -rf dirnameForce remove (no prompts)
rm -rv dirnameRemove 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.

DistributionPackage manager / baseEquivalent commandDifference 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

Related File Management commands