DELAPARRA
Index
Color
NL
Category: CLI commands

rm

Explained by Updated

What is rm?

rm: Remove — Delete files or directories. rm deletes files. rm old.log removes one file, rm -r folder removes a folder and everything in it, and rm -f skips confirmations and errors for missing files. There is no recycle bin. Deleted files are gone, which is why rm -rf deserves respect. A space in the wrong place, or a variable that turns out to be empty, can delete far more than intended.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about rm

What should you keep in mind with rm?

A few habits protect you. Run ls with the same path first to see what would be deleted. In scripts, check that variables are set before using them in a path, for example with ${DIR:?} in Bash, which stops the script when DIR is empty. Use rm -i when deleting interactively in unfamiliar folders. And keep backups, because sooner or later everyone deletes something they needed.

At a glance

CategoryCLI commands
Explained by
Updated

More CLI commands terms

All terms starting with R

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.