1/7

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.txt

What happened

  • No output, no question, no confirmation: notes.txt is simply gone, as ls shows.

Common mistakes

  • Expecting a are you sure? question. Plain rm never asks.
  • Using rm on 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.txt
learner@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