Files and folders
The rm command
Deletes files. With -r, whole folders. There is no recycle bin.
Syntax
rm [-r] <archivo>...Most useful options
-rDeletes folders and everything inside-fDoes not ask or warn about errors-iAsks before each deletionCopy-ready examples
$ cp Documentos/apuntes.txt temporal.txt && rm temporal.txtDelete a file$ mkdir practica && rm -r practicaDelete a whole folderYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- On Linux there is no recycle bin: what is deleted is gone.
FAQ
How do I delete an empty folder?
With rmdir, or rm -r if you do not care about the content.
Is rm -rf dangerous?
Very much: -r deletes recursively and -f does not ask. Use it wisely.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course