Skip to main content
Kill -9 Club
Sign in

rm

FilesPackage: coreutilsHandle with care

Deletes files, with no bin and no confirmation. What rm -rf removes is gone; the only protection is what you typed before Enter, and an empty variable turns /var/www/$app into /var/www/ there.

A mistake with this command can destroy data or lock you out

  • rm -rf on a path built from a variable: if the variable is empty, the target is the parent directory. Write "${app:?}" so the shell refuses, and ls the target first.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

rm -r
Removes a directory and everything in it.
rm -f
Asks nothing and ignores missing files. Combined with -r, nothing stops you: this is the pairing never to type from memory.
rm -i
Asks for confirmation on every file. Safe, and quickly unbearable: over a hundred files you answer “yes” a hundred times without reading.
rm -I
Asks once, and only from three files upwards or with -r. This is the useful compromise: the question comes when the command is large, which is when it deserves re-reading.

Lessons that teach it