Skip to content
CodeItRaw
Terminal Basics

Lesson 2/5

Four commands cover work with files and folders: mkdir makes a folder, cp copies, mv moves (or renames; the two are the same job), rm deletes. They all have the same shape: the command, then what it works on.

mkdir -p backups/2024
echo "first line" > log.txt
echo "second line" >> log.txt
cp log.txt backups/2024/
mv log.txt old.txt
mkdir -p makes the missing folders in between as well. echo writes the text you give it; > sends that output to a file instead of the screen and writes the file from scratch, while >> adds to its end. cp source target, mv source target: if the target is a folder, the file goes inside it.

The short additions that change how a command behaves are options, and they start with -: ls -l lists with details, rm -r deletes a folder with everything in it. If you do not remember a command's options, type help here; in a real terminal, man command.

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

    Make folders

    Terminal task

  2. 02

    Write to a file

    Terminal task

  3. 03

    Move and copy

    Terminal task

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