aboutsummaryrefslogtreecommitdiff
path: root/course/chapters/03-commands.json
blob: 10807cbda3c2b0c9764fb3aa4b946d9f27443280 (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
{
  "id": "03-commands",
  "title": "Command mastery",
  "icon": "⌨",
  "level": "beginner",
  "lessons": [
    {
      "id": "3.1",
      "title": "Find any command fast",
      "objective": "Use help, commands and check to discover what exists before guessing.",
      "minutes": 7,
      "commands": [
        "help",
        "status"
      ],
      "blocks": [
        {
          "type": "text",
          "text": "`help` groups all 344 commands by the module that owns them."
        },
        {
          "type": "cmd",
          "text": "help"
        },
        {
          "type": "cmd",
          "text": "help webdav-push"
        },
        {
          "type": "tip",
          "text": "`check` shows module requirements — the fastest way to explain a command that is listed but not working."
        }
      ],
      "exercise": {
        "instruction": "Open the help for `webdav-push`.",
        "accept": [
          "help webdav-push"
        ],
        "check": {
          "type": "command"
        },
        "hint": "Type: help webdav-push"
      },
      "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": "ls | grep txt"
        },
        {
          "type": "warn",
          "text": "`sed s/x/y/` substitutes the first match per LINE, not per file. `sed -i` is flagged destructive and needs confirmation."
        },
        {
          "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 the current listing for `txt`.",
        "accept": [
          "ls | grep txt",
          "grep txt"
        ],
        "check": {
          "type": "command"
        },
        "hint": "Type: ls | grep 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"
      ]
    }
  ]
}