t27.aiРусский

Ten terminal commands

You will learn

Ten terminal commands that cover a first day, and the one of them that cannot be undone.

The terminal is a window where you type a command and press Enter. Ten commands go a long way: pwd, ls, cd, mkdir, touch, cat, cp, mv, rm and clear. They are safe to try, with one exception: rm deletes a file with no undo, so read it twice before you press Enter. The spec lists all 10 with a one-line meaning each and marks exactly 1 of them as having no undo.

Try it

In the spec, find the list NO_UNDO. Mark cat with a 1 as well and run the player: the test that counts the commands with no undo fails. Then put it back to 0.

Open the interactive lesson →

Vibecoding 5: ten terminal commands ↗

Ten terminal commands that cover a first day, each with a one-line meaning, and the one that cannot be undone. Lesson 5 of the vibecoding course.

specs/vibecoding/ten_commands.t27

// SPDX-License-Identifier: Apache-2.0
; specs/vibecoding/ten_commands.t27 -- lesson 5 of the vibecoding course: ten terminal commands
; Ten commands cover most of a beginner's day in the terminal. Each has a one-line meaning, and
; each has a flag: 1 if it destroys something with no undo, 0 if it does not. Only rm does.
; ASCII only (L3), English only (LANG-EN).
; phi^2 + 1/phi^2 = 3 | TRINITY

module vc_ten_commands;

pub const COMMAND_COUNT : u8 = 10;
pub const COMMANDS : [10]str = ["pwd", "ls", "cd", "mkdir", "touch", "cat", "cp", "mv", "rm", "clear"];
pub const MEANINGS : [10]str = [
    "print the folder you are in",
    "list what is in this folder",
    "change to another folder",
    "make a new folder",
    "make a new empty file",
    "print a file's text",
    "copy a file",
    "move or rename a file",
    "delete a file with no undo",
    "wipe the screen, keep your files"
];
; 1 = no undo, 0 = safe to try.
pub const NO_UNDO : [10]u8 = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0];
pub const RM_INDEX : u8 = 8;

test there_are_ten_and_the_last_one_is_clear {
    assert COMMAND_COUNT == 10;
    assert COMMANDS[0] == "pwd";
    assert COMMANDS[9] == "clear";
    assert MEANINGS[9] == "wipe the screen, keep your files";
}

test the_names_and_meanings_line_up {
    assert COMMANDS[RM_INDEX] == "rm";
    assert MEANINGS[RM_INDEX] == "delete a file with no undo";
}

test exactly_one_command_has_no_undo {
    assert NO_UNDO[RM_INDEX] == 1;
    assert NO_UNDO[0] + NO_UNDO[1] + NO_UNDO[2] + NO_UNDO[3] + NO_UNDO[4] + NO_UNDO[5] + NO_UNDO[6] + NO_UNDO[7] + NO_UNDO[8] + NO_UNDO[9] == 1;
}

Open the lesson's spec in the player ↗

All lessons