$
Learn Linux handbook
en
XP:0
Quest 21Cleaner
+200 XP

Removing Files & Folders

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

Concept & Overview

When you clean up your physical desk, you might throw old papers into a recycling bin where you can retrieve them if you made a mistake. In Linux, there is no safety net—when you delete something from the terminal, it is gone forever!

- The rm command deletes files.
- Because folders can contain other files, rm won't delete a folder by default. You must add the -r (recursive) flag to tell Linux to dive in and delete the folder along with everything inside it.

Why this matters: If you run rm downloads without -r when downloads is a folder, you'll get: rm: cannot remove 'downloads': Is a directory. The -r flag tells Linux to recursively delete the folder and everything inside it.

Let's clean up our home directory. Permanently delete the downloads folder and all its contents by running rm -r downloads.

Command Syntax Reference

Command / SyntaxDescription
rm -r downloadsDelete folder recursively

Verification Objectives

These conditions will be automatically verified when you run commands inside the interactive terminal simulator:

  • ○
    Use the "rm" command with -r flag
  • ○
    Directory /home/learner/downloads is deleted

Ready to complete Quest 21?

Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.