Files & folders · Delete files and folders
Delete a file: rm
rm (remove) deletes files.
Careful: there's no trash can and no undo. A file you rm is gone. So look first (with ls), and type the name carefully.
How to type it: rm file, or several files: rm a.txt b.txt.
Worked example
learner@shellstreak:~$ rm notes.txtWhat happened
- No output, no question, no confirmation:
notes.txtis simply gone, aslsshows.
Common mistakes
- Expecting a are you sure? question. Plain
rmnever asks. - Using
rmon a folder: it refuses with Is a directory. The next card covers folders.
Tap Run to delete your notes, then type ls.
Try it:
rm notes.txtlearner@shellstreak: ~
Starting your practice shell…
You can also type in the terminal yourself. Try anything: you can't break it.
Go deeper: Basic terminal commands for beginners