WeCodeAcademy

Deleting with rm

rm file deletes a file. There is no recycle bin in a real terminal, so be careful.

Examplebash
Open in editor »
/ $

Folders need -r, which removes the folder and everything inside it.

Examplebash
Open in editor »
/ $

The first rm old fails on purpose: it protects you from deleting a folder by accident.

Quick check

Which command deletes the folder `old` and its contents?

Your turn: write the code

Create a.txt and b.txt, delete a.txt, then list the folder.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.