rm

Delete files and folders

What it does

rm deletes files. The terminal has no trash: what you delete cannot be brought back by ordinary means.

Folders are deleted with -r, together with everything inside. -i asks for confirmation for every file, while -f does the opposite: no questions, and no complaints about missing files.

Careful. rm deletes for good, with no trash. Take special care with rm -rf and patterns like *: first check what they match by running ls with the same argument.

Syntax

rm <file>…
rm -r <folder>
rm -i <file>

Examples

Related commands

Practise · All commands