rm — remove files and directories
cheat sheet · Ubuntu 24.04 · GNU coreutils 9.4 https://lab.dimsanych.ru/en/wiki/rm/Cheat sheet
-
rm notes.txtdelete a file -
rm -i *.logask about every file -
rm -I *.logask once if there are more than three -
rm -r old-projecta directory with everything inside -
rm -rf build/no prompts, no errors about missing files -
rm -d empty-diran empty directory (like rmdir) -
rm -v *.tmpprint each removal -
rm -- -file.txta name that starts with a dash -
ls *.log && rm -i *.loglook first, then delete
Options
Full list — man rm. In practice -i, -I, -r, -f, -v are enough.