DWTutorials:Linux Basics for Beginners/Answer Key: Difference between revisions
m Protected "DWTutorials:Linux Basics for Beginners/Answer Key" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 6: | Line 6: | ||
'''For DWShells staff and course mentors''' | '''For DWShells staff and course mentors''' | ||
This page supports the student course [[Linux Basics for Beginners]]. Protect it if you do not want learners to see suggested answers before completing their work. | This page supports the student course [[DWTutorials:Linux Basics for Beginners]]. Protect it if you do not want learners to see suggested answers before completing their work. | ||
'''Copyright:''' © 2026 DarkWorld Network. All rights reserved. | '''Copyright:''' © 2026 DarkWorld Network. All rights reserved. | ||
Latest revision as of 02:21, 22 July 2026
Instructor Answer Key
For DWShells staff and course mentors
This page supports the student course DWTutorials:Linux Basics for Beginners. Protect it if you do not want learners to see suggested answers before completing their work.
Copyright: © 2026 DarkWorld Network. All rights reserved.
Assessment model
| Component | Weight | Evidence |
|---|---|---|
| Lesson review questions | 30% | Accurate explanations in the learner's own words |
| Hands-on labs | 40% | Correct files, command output, permissions, and safe working habits |
| Final project | 30% | Script, report, documentation, permissions, archive, and restore test |
Suggested pass mark: 70%. Safety violations should be corrected before the learner passes, even if the numeric score is high.
Accept equivalent commands when they are safe and produce the required outcome. Do not require output to match usernames, paths, dates, process IDs, hostnames, package versions, or file sizes shown in the course.
Lesson 1 answers
- A terminal is the interface/application used to enter commands; a shell is the program that interprets those commands.
- SSH (Secure Shell).
- Linux deliberately does not echo password characters, reducing information visible to someone watching.
pwd.- Ctrl+C.
Lab check: Learner can connect, identify the current user and host, print the requested sentence, recall history with the Up arrow, log out with exit, and reconnect.
Lesson 2 answers
/is the top of the filesystem;/rootis normally the root administrator's home directory.- The current user's home directory.
-a.- Absolute, because it begins with
/. .is the current directory;..is its parent.
Lab check: Ask the learner to move to /etc, report pwd, return home, and explain why cd - may produce a different location than cd ...
Lesson 3 answers
mkdir -p.cp -r SOURCE DESTINATION.mv.- It asks before removal and helps prevent an accidental deletion.
- Non-hidden names ending in
.txtin the selected directory.
Expected lab structure:
lesson-03/
├── activity.log
├── one.txt
└── practice/
├── archive/
│ └── activity.log
├── one.txt
└── two.txt
The top-level two.txt should have been removed. Extra files from earlier examples are acceptable.
Lesson 4 answers
lessis better for long content because it supports paging and searching.q.- Ctrl+O.
headdisplays the beginning;taildisplays the end.- The compared files are identical.
Lab check: profile.txt contains the requested content. The learner can save and exit Nano, select first/last lines, count lines, and explain the diff -u result.
Lesson 5 answers
--help.man COMMAND.q.- Whether a command exists and what executable, builtin, function, or alias the shell will use.
- They may be saved in history and exposed later.
Lab check: The learner identifies mkdir -p, understands that cd is a shell builtin, and uses history | tail -n 10 or an equivalent safe command.
Lesson 6 answers
- Owner, group, and others.
- 5: read (4) plus execute (1).
- It permits traversal/entry and access to known names, subject to other directory permissions.
chmod.- It grants read, write, and execute permissions to everyone, allowing unauthorized modification.
Expected permissions:
-rw------- private.txt -rw-r----- shared.txt drwx------ private-dir
The learner should demonstrate the difference between ls -l and ls -ld for a directory.
Lesson 7 answers
>replaces/truncates;>>appends.- 2.
- It connects one command's standard output to the next command's standard input.
uniqnormally recognizes only adjacent duplicates, so sorting brings equal lines together.- Success.
Lab check: The learner can use grep -i, wc -l, sort, >>, 2>, and tee, and can explain where normal and error output went.
Lesson 8 answers
- To avoid slow, resource-intensive traversal and irrelevant permission errors.
-iignores case;-vinverts the match.- No.
- To preserve the entire value as one argument and prevent wildcard expansion or word splitting.
- It runs
date +%Fand substitutes its YYYY-MM-DD output.
Lab check: The learner creates and accesses a filename containing a space without accidental splitting, and uses a quoted variable correctly.
Lesson 9 answers
- Process ID.
jobsshows jobs associated with the current shell;psqueries system processes according to its options.- SIGTERM.
- It prevents the process from cleaning up files, locks, and state.
- The server is shared, resource limits protect everyone, and technical availability is not authorization.
Lab check: No practice sleep process should remain. The learner must verify ownership and PID before sending a signal.
Lesson 10 answers
/etc/os-release.dfreports filesystem capacity;duestimates space used by files/directories.- ICMP may be filtered even while the destination and other services are available.
-t.- Uppercase
-P.
Lab check: The archive lists and extracts successfully into a separate directory. The original data remains unchanged. If SCP cannot be tested, the learner should still explain local and remote sides correctly.
Lesson 11 answers
- The first line that selects the script interpreter, such as
#!/bin/bash. - The current directory is not normally searched through
PATH;./names the path explicitly. $0is the script name and$1is the first argument.- 0.
- To preserve spaces and prevent unintended splitting or wildcard expansion.
Lab check: course-summary.sh passes bash -n, rejects a missing name with a non-zero exit status, writes the required fields, and sets the output to 600.
Lesson 12 answers
- The private key stays on the learner's local device and is never shared. Only the public key is installed on the server or sent to authorized staff.
700for~/.sshand600forauthorized_keys.- The downloaded content runs before the learner has inspected or verified it.
- No. Technical access is not authorization.
- Stop and ask DWShells staff before proceeding.
Lab check: The learner can explain host-key checking, password/key privacy, safe permissions, shared-resource responsibility, and why policy applies even to technically possible actions.
Final project reference implementation
This is one valid implementation of bin/learner-report.sh. Learners may organize their code differently.
#!/bin/bash
set -u
umask 077
if [ "$#" -ne 1 ]; then
echo "Usage: $0 DISPLAY_NAME" >&2
exit 1
fi
display_name="$1"
script_dir="$(cd -- "$(dirname -- "$0")" && pwd)"
project_dir="$(dirname -- "$script_dir")"
output_dir="$project_dir/output"
output="$output_dir/learner-report.txt"
mkdir -p "$output_dir"
if [ -r /etc/os-release ]; then
debian_version="$(. /etc/os-release; printf '%s' "$PRETTY_NAME")"
else
debian_version="Unknown"
fi
{
echo "DWShells Linux learner report"
echo "Learner: $display_name"
echo "Username: $USER"
echo "Hostname: $(hostname)"
echo "Generated: $(date --iso-8601=seconds)"
echo "Debian: $debian_version"
echo "Kernel: $(uname -r)"
echo "Architecture: $(uname -m)"
echo "Home: $HOME"
echo
echo "Linux course usage:"
du -sh "$HOME/linux-course"
echo
echo "Home filesystem:"
df -h "$HOME"
} > "$output"
chmod 600 "$output"
echo "Report written to $output"
exit 0
Suggested checks:
cd "$HOME/linux-course/linux-final"
bash -n bin/learner-report.sh
bin/learner-report.sh
echo "$?"
bin/learner-report.sh "Test Learner"
echo "$?"
stat -c '%a %n' bin/learner-report.sh output/learner-report.txt
cat output/learner-report.txt
Expected permissions are 700 for the script and 600 for the report. A missing name should produce a non-zero status; a successful run should produce status zero.
Final project rubric
| Area | Points | Full-credit standard |
|---|---|---|
| Required directory structure | 3 | All required directories and files exist in the correct locations. |
| README | 3 | Clearly explains purpose, requirements, command syntax, and output. |
| Command notes | 3 | Ten correct commands with clear one-line explanations. |
| Argument validation | 3 | Missing display name produces usage on stderr and exits non-zero. |
| Report content | 6 | All nine required fields are present and accurate. |
| Quoting and safe paths | 3 | Variables are quoted; script works regardless of the caller's current directory. |
| Permissions | 2 | Script is 700 and report is 600. |
| Syntax and repeatability | 2 | Passes bash -n and runs twice without unsafe side effects.
|
| Archive and restore | 3 | Archive lists correctly and restores all files into a separate test location. |
| Security and policy | 2 | No secrets, privilege escalation, broad searches, destructive operations, or prohibited activity. |
| Total | 30 | Suggested pass for this component: 21/30 |
Common deductions and coaching
| Issue | Coaching response |
|---|---|
Learner typed the example $ prompt.
|
Re-explain prompt versus command; have them retry. |
| Paths or variables are unquoted. | Test with a display name or path containing a space and explain word splitting. |
Learner used chmod 777.
|
Ask which identities need each permission, then choose the minimum required mode. |
| Learner used SIGKILL first. | Practise SIGTERM, wait, recheck, and reserve SIGKILL for a verified last resort. |
Learner searched from /.
|
Stop the command and narrow the starting path to $HOME or the project.
|
| Learner copied a command without understanding it. | Ask them to explain every program, option, argument, redirection, and expansion before rerunning. |
| Report exposes secrets. | Remove the data, rotate any exposed credential, correct the script, and explain secure secret handling. |
Pre-publication staff checklist
Before each course intake:
- Confirm the current SSH hostname and port.
- Publish or provide the current SSH host-key fingerprint through a trusted channel.
- Confirm which account home layouts are active, such as
/home/free/USERand/home/support/USER. - Test command availability:
bash,nano,man,less,find,grep,tar,getent,curl,ping,quota, andstat. - Mark unavailable optional commands in the student page.
- Link the current DWShells Acceptable Use Policy and support channel.
- Verify storage, process, CPU, memory, and network limits.
- Test every lab using an ordinary free account and an ordinary support account—not root.
- Confirm that home-directory permissions prevent cross-user data exposure.
- Confirm that the answer-key page is protected as intended.
DWTutorials Linux Basics Instructor Answer Key — © 2026 DarkWorld Network. All rights reserved.