Delete files and folders with rm
Remove files and directory trees from the shell — with the guard rails you should always use.
01Command
$ rm -i report-draft.txt && rm -ri old-build/02What it does
rm unlinks files immediately — nothing goes to a trash can. -r is required for directories, -i asks before each deletion, and -I (capital) prompts once for three or more files, a good middle ground. Wildcards like rm *.tmp work, but the shell expands them before rm ever sees the list.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- rm(1) — Linux manual pageEvidence: rm removes files; -r deletes directories recursively, -i prompts before every removal, and deleted files are not moved to any trash.
Last verified: 2026-09-18 · Category: Files & Folders
06Related solutions
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.
Unpack a gzipped tarball into the current directory while printing each file as it is extracted.
Show total, used, and available space plus usage percentage for every mounted filesystem in human-readable units.