Skip to content
CodeItRaw
Terminal Basics

Lesson 3/5

You do not type the names of a hundred files one by one. The shell reads * in a name as "anything" and, before running the command, replaces it with the file names that match: *.txt is every .txt file in this folder.

ls *.txt
rm cache/*.bak
find src -name "*.py"
find . -name "README*"
* looks only at the folder you are in (or the one you wrote); it does not go into subfolders. To search every subfolder you use find: first where to start, then with -name the name pattern wanted.

Before deleting, try the same pattern with ls: ls build/*.tmp shows what would go, and typing rm with that pattern comes after. The habit keeps you from deleting the wrong files with the wrong pattern.

Tasks

Tasks open in order. Solve them all and the next lesson opens.

This lesson's tasks open when the lessons before it are finished. You can read the explanation now.Go to the current lesson

  1. 01

    Delete by pattern

    Terminal task

  2. 02

    Find files

    Terminal task

If you would rather not wait for the order, every problem is open without locks: Problem list