aboutsummaryrefslogtreecommitdiff
path: root/course/chapters/03-commands.json
blob: 40fa2ad85f7ea7dcf66b7fcbcc6f42ac00291f7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
{
  "id": "03-commands",
  "title": "Command mastery",
  "icon": "⌨",
  "level": "beginner",
  "lessons": [
    {
      "id": "3.1",
      "title": "Find any command fast",
      "objective": "Use help, doctor and status to discover what exists before guessing.",
      "minutes": 7,
      "commands": [
        "help",
        "doctor",
        "status"
      ],
      "blocks": [
        {
          "type": "text",
          "text": "`help` groups every registered command by the module that owns them."
        },
        {
          "type": "cmd",
          "text": "help"
        },
        {
          "type": "cmd",
          "text": "help webdav-push"
        },
        {
          "type": "tip",
          "text": "`doctor` shows module requirements — the fastest way to explain a command that is listed but not working."
        }
      ],
      "exercise": {
        "instruction": "Run `doctor` and read its severity ranking.",
        "accept": [
          "doctor",
          "help",
          "status"
        ],
        "check": {
          "type": "command"
        },
        "hint": "Type: doctor"
      },
      "quiz": {
        "q": "Which command shows usage for one command?",
        "options": [
          "help <cmd>",
          "status",
          "ls"
        ],
        "answer": 0
      },
      "sources": [
        "modules/core/module-system.js",
        "modules/core/module-manager.js"
      ]
    },
    {
      "id": "3.2",
      "title": "Pipes, grep, sed, tail",
      "objective": "Combine commands and understand the two semantics that bite: per-line sed and tail -f deltas.",
      "minutes": 12,
      "commands": [
        "grep",
        "sed",
        "tail",
        "sort",
        "head"
      ],
      "blocks": [
        {
          "type": "text",
          "text": "Pipes feed one command into the next. `grep` filters lines, `sed` substitutes text, `tail` prints the end of a file."
        },
        {
          "type": "cmd",
          "text": "grep hello hello.txt"
        },
        {
          "type": "warn",
          "text": "`sed s/x/y/` substitutes the first match per LINE, not per file. `sed -i` overwrites the file immediately — checkpoint first (`checkpoint before-sed`). Pipes are partial in this build: `ls | grep x` may print the unfiltered listing; use `grep pattern file`."
        },
        {
          "type": "text",
          "text": "`tail -f` is interactive and stops with Ctrl+C. AI-initiated commands get a bounded read instead."
        },
        {
          "type": "cmd",
          "text": "tail hello.txt"
        }
      ],
      "exercise": {
        "instruction": "Search a file for a word (create `hello.txt` with `edit` if needed).",
        "accept": [
          "grep hello hello.txt",
          "grep * hello.txt",
          "grep hello *"
        ],
        "check": {
          "type": "command"
        },
        "hint": "Type: grep hello hello.txt"
      },
      "quiz": {
        "q": "`sed s/a/b/` replaces…",
        "options": [
          "every match in the file",
          "the first match on each line",
          "only the last line"
        ],
        "answer": 1
      },
      "sources": [
        "modules/core/module-fs.js",
        "modules/ext/shell.js",
        "modules/core/terminal.js"
      ]
    }
  ]
}