Commands · Command

CommandLinuxmacOS

rm

rm [options] file...

Deletes files (or, with -r, directories) permanently from the filesystem.

// FLAGS

-rrecursive, required for directories
-fforce — suppress prompts and nonexistent-file errors
-iprompt before every removal
-vverbose

// EXAMPLE

rm -rf old-build/ — deletes the directory and everything inside it with no confirmation.

// GOTCHA

There's no recycle bin or undo — rm -rf on the wrong path is one of the most common catastrophic mistakes on Linux/macOS. Always double-check the path before adding -f.

// RELATED COMMANDS