Time to be blunt about this one.
There is no trash can
When you delete a file in a graphical file manager, it goes to the trash. You can change your mind.
The terminal has no such thing. rm removes the file, and there is nowhere to look for it afterwards.
rm draft.txt
Silent, instant, permanent. No confirmation, no “are you sure”, no undo.
Important
This is not a scare tactic and it is not a simulator quirk. On a real machine, a file removed with rm is genuinely unrecoverable by any normal means. Professionals lose work to this every year.
Quick check
You delete a file with rm and immediately regret it. Where do you look for it?
Deleting a folder: -r
Point rm at a folder and it refuses:
rm temp
rm: cannot remove 'temp': Is a directory
That refusal is deliberate. A folder can hold hundreds of files, and deleting it deletes all of them. So rm makes you ask again, explicitly, with -r for recursive:
rm -r temp
Now temp and everything inside it is gone, at every depth.
Quick check
Why does rm need -r for a folder when it does not for a file?
The flag combination to slow down for
-f stands for force. It tells rm to stop objecting — including about files that do not exist, and about things it would normally hesitate over.
Put them together and you get rm -rf, which means: delete this folder and everything in it, recursively, and do not complain about anything.
It is a legitimate command. Cleaning a build folder is exactly what it is for. What makes it dangerous is that it removes every guard rail at the same moment you are handing it a — and if that path is wrong, nothing will stop you.
Important
The infamous one is rm -rf /, which aims the whole thing at the root of the disk. This simulator will refuse it and tell you off. Your laptop will not be as friendly.
Quick check
An AI agent proposes `rm -rf node_modules`. Is that reasonable?
The habit that actually protects you
Not fear. A two-second routine:
lsthe folder, so you can see what you are about to delete.- Read the path in your
rmcommand out loud, once. - Then run it.
Most rm accidents are not typos in the command — they are the right command aimed at the wrong folder, run by someone who did not check where they were standing. pwd and ls are the cure.
Tip
On a real machine there is a better default: put things in a trash folder of your own with mv, and empty it when you are sure. mv is reversible; rm is not.
Try it
The scratch folder has one file to keep, one to delete, and a whole folder of rubbish.
ls— look before you delete.rm draft.txt— remove the file.rm -r temp— remove the folder and its contents.ls— confirm thatold-notes.txtis still there.
Step 4 matters as much as steps 2 and 3. Deleting the right things is only half the job; the other half is confirming you did not take anything else with them.