How to delete files and folders
Overview
Terminal deletion normally bypasses the desktop Trash. rm removes files, while rmdir removes empty directories.
Examples
rm old-note.txt
rm -i *.tmp
rmdir empty-folder
rm -r old-project
Options
-iasks before each removal-Iasks once before a large or recursive removal-rdescends through a directory tree-fforces removal and suppresses many warnings--ends options before a name beginning with a dash
Critical safety
Do not use rm -rf casually. It combines recursive deletion with forced, non-interactive behavior and can erase a mistyped path immediately.
Check pwd, preview with ls, use exact names, and avoid sudo rm -rf. Keep backups of important data.