Ad space (banner)
🖥️Linux Lessons
Lesson 13 / 61

Deleting with rm (Use Caution!)

rm is for when "I want to delete a file I no longer need." rm stands for remove, and it deletes the given file. Use it with care.

Use it in the form rm filename. To delete an entire folder, add the -r option; to force-delete without confirmation, add -f.

Running rm notes-copy.txt deletes notes-copy.txt. It doesn't go to a trash can — it's gone immediately, with no way to undo it.

A common early mistake is carelessly attaching a powerful option like rm -rf and wiping out a huge number of files in the wrong folder entirely. Always double-check your target before running it.

In real work, this is used to remove unneeded build artifacts or temp files, but especially careful handling is required in production, to prevent accidents.

Linux
Try it (type this into the pseudo terminal)
rm notes-copy.txt

🧑‍💻 You can type this command into the Linux pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)