0%

The Command Line · practice

Command-Line Checkpoint

A request arrives: here is a source folder, here is where things go once they are reviewed, and here is one reference file that must come through untouched.

This is where separate commands become a procedure. Orient, inspect, change one exact target, verify. You already know every command you need, and nothing new is introduced here.

Starting conditions

Graded from the workspace. Use Reset first if an earlier attempt left checkpoint/reviewed behind. The checkpoint subtree starts like this:

/workspace/checkpoint
├── inbox
│   ├── brief.txt
│   └── draft.txt
└── reference
    └── keep.txt

with these contents:

inbox/brief.txt: Check the source before you copy it.
inbox/draft.txt: Rename this draft when you move it.
reference/keep.txt: This reference file must not change.

Open the and confirm you are at /workspace. If you are not, move there before starting.

Your task

1. Orient and inspect

List checkpoint and preview its two supplied directories. Move into it, confirm you arrived at /workspace/checkpoint, then confirm inbox/brief.txt is a file and read its contents.

Now run this on purpose and read the error carefully:

cat ./inbox/missing.txt

That failure is part of the exercise. Notice what it tells you: the found the command and ran it, and the command could not find the path it was given. Command lookup succeeded; the target did not exist. Two different layers, and the message distinguishes them if you read it.

2. Build the reviewed output

Recover by listing inbox and using the brief.txt that is actually there. Create reviewed, copy inbox/brief.txt to reviewed/brief.txt, and preserve the source. Copy inbox/draft.txt into the reviewed folder, then rename that copy to final.txt. Leave both inbox files in place.

3. Remove one disposable target

Create an empty reviewed/remove-me.tmp, see it in a listing, preview its removal where your shell supports that, then remove that exact file.

4. Record and verify completion

Write the single word complete to reviewed/status.txt. This is a plain completion receipt; the previous lesson already demonstrated environment inheritance with its supplied child program. List the reviewed folder and read the three result files before submitting.

Constraints and required final state

Work only below /workspace/checkpoint. Name one target at a time rather than matching several at once, and use no options that widen or force an operation. Do not alter or remove reference/keep.txt, inbox/brief.txt, or inbox/draft.txt.

That failed read in step 1 is diagnostic practice. Do not create missing.txt to make the message go away. Making an error disappear is not the same as understanding it, and the troubleshooting chapter depends on the difference.

Your final tree must satisfy all of this:

  • inbox/brief.txt and inbox/draft.txt both still exist with their original lines.

  • reviewed/brief.txt matches inbox/brief.txt.

  • reviewed/final.txt holds the original content of inbox/draft.txt; the intermediate reviewed/draft.txt no longer exists.

  • reviewed/status.txt contains exactly the completion receipt complete.

  • inbox/missing.txt still does not exist; the deliberate failure was evidence, not an instruction to create it.

  • reviewed/remove-me.tmp does not exist.

  • reference/keep.txt still reads This reference file must not change.

Verify it yourself before submitting: list reviewed, then read each of the four files named above. The listing must show brief.txt, final.txt, and status.txt, and no temporary file. The contents must be:

Check the source before you copy it.
Rename this draft when you move it.
complete
This reference file must not change.

Leave that state and press Check my work.

Reading ./inbox/missing.txt reports that it cannot find the path. What is the best first response?

The check reads your final tree rather than your command history, and that is deliberate. Nobody inheriting this folder cares which keystrokes produced it. They care that the reviewed files are there, the originals survived, and the reference is untouched.

You have finished the , with a routine that works the same way on your own machine as it does here. Next, what to do when a command does not behave: which shell you are actually talking to, how a command name gets found at all, and how to tell which layer failed.