Command library / rm
rm
Delete files and directories
Removes files permanently — there's no trash can in the shell, no undo. -r is required to remove a directory (recursively, including everything inside it); -f suppresses confirmation prompts and missing-file errors, which makes it powerful and dangerous in the same breath.
Practice rmUsage
Options and flags
fileone or more files or directories to delete
-r, -R, --recursiveremove directories and everything inside them
-f, --forcenever prompt, ignore nonexistent files
-i, --interactiveask for confirmation before every removal
Examples
rm old-report.txtDelete a single file, permanently.
rm -r build/Delete a directory and everything inside it.
rm -i secrets.txtDelete with a confirmation prompt first — cheap insurance on something you're unsure about.
Common mistakes
rm refuses to remove a directory unless you explicitly ask with -r — this is a deliberate safety brake, not a bug.