LearnLinux FoundationsSpecial

Operation Black Box

script - a hands-on Linux lab on a real virtual machine.

The Special module capstone mission. Drill script, true, and false in one hands-on operation on a real Linux VM: record a session with script, then prove the exit-code contract by running true and false and reading their codes. Mission mode: no commands shown, recall required.

You have finished the Special module. Three tools are yours now. script is the recorder: it captures a whole terminal session to a file you can read back later. true is the command that does nothing and always succeeds, exit code 0. false is its mirror image: it does nothing and always fails, exit code 1.

This is the final run. One real machine, three objectives, and every one of them uses a tool you already trained. The job ties them together: you switch on the recorder, then prove the exit-code contract by running the always-succeed command and the always-fail command and reading back the codes they leave behind. Nothing new is introduced here.

This is mission mode. No commands are shown. You read the objective, recall the tool, and type it. That recall is the whole point: it is how these three moves become instinct. Progress checks itself as you go, and a signal is one click away if you get stuck.

One quick rep in the practice terminal before the real machine boots. Same rules as the mission: the goal is stated, the command is not. If this comes back instantly, you are ready.

You want to prove the always-succeed command really does succeed. It prints nothing itself, so run it and then reveal the exit code it leaves behind. Success is 0.

prompt: student@linuxcamp:~$ answer: true; echo $? output: 0 hint: The always-succeed command, a semicolon, then the reveal trick: true; echo $?

That move came from memory, not from a copy button. Good. The mission asks for that same recall three more times, this time inside a session you record.

Boot the machine below and take the console. Three objectives: switch on the recorder to capture a session, run the always-succeed command and read its code, and run the always-fail command and read its code. No commands shown, progress checks itself as you type.

Practice Operation Black Box in a real Linux terminal at The Linux Camp. Progress is verified automatically as you type commands on the machine.