Removing Things, and the Command That Deserves Respect
The commands.
rm file removes a file.
rmdir dir removes a directory, but only if it is empty.
rm -r dir removes a directory and everything inside it.
rm -f ignores anything that is not there rather than complaining.
✦ There is no recycle bin
rm does not move a file to a trash folder. It unlinks it, and it is gone. No undo, no confirmation, no undelete. This is not a design flaw, it is what makes the shell usable for scripting, but it means rm deserves a moment of attention every time you use it, especially with -r.
Why rm -rf is the famous one. Combined, -r recurses into directories and -f suppresses complaints. It is genuinely the right tool for deleting a build directory. It is also the command that erases a project when the path is slightly wrong.
The habit that protects you is simple: run ls on the path first. If ls thepath shows what you expected to delete, then rm -r thepath will delete what you expected.
Mark this lesson complete
Signed in, your progress follows you to every device.