# Recovery Instructions This file explains how to recover the working context for this Linux+ Emacs study project. Use this file when ChatGPT or another assistant has lost context, when starting a new chat, or when restoring the workflow from the repository alone. ## Project Summary This is a GNU Emacs-based CompTIA Linux+ study system. The user studies Linux+ topics through Emacs Lisp lesson files and corresponding quiz files. Lessons display instructional text in an Emacs buffer and open an `ansi-term` buffer for hands-on Linux commands. Quizzes use a custom quiz engine to test the lesson material and reinforce weak areas. The repository is the source of truth for the project. ## Read These Files First Read files in this order: ``` 1. README.md 2. RECOVERY.md 3. dotemacs 4. linuxplus-load-all.el 5. 06-linuxplus-quiz-mode.el 6. The highest-numbered lesson file 7. The highest-numbered quiz file 8. STUDY.md ``` The highest-numbered lesson and quiz files are usually the best examples of the current project style. Older files may not reflect the latest conventions. ## Important Workflow Facts The user’s `.emacs` setup already loads the Linux+ system. The repository may contain a copy of that file named: ``` dotemacs ``` The relevant startup code is: ``` ;; Load custom Elisp (let ((dir "~/.emacs.d/lisp/linuxplus/")) (add-to-list 'load-path dir) (load (concat dir "linuxplus-load-all.el")) (linuxplus-load-all)) ``` Therefore, after saving new lesson or quiz files into: ``` ~/.emacs.d/lisp/linuxplus/ ``` the correct refresh step is: ``` M-x linuxplus-load-all ``` Do not tell the user to manually add the directory to `load-path`, manually load `linuxplus-load-all.el`, or manually require individual lesson/quiz files unless specifically troubleshooting the loader. ## Loader Behavior The loader file is: ``` linuxplus-load-all.el ``` The function: ``` linuxplus-load-all ``` loads the numbered Linux+ Emacs Lisp files. Future generated files should fit the existing loader behavior rather than requiring special manual loading. ## Numbering Scheme Lesson and quiz files are separate. The current convention uses consecutive numbers for each lesson/quiz pair. Example: ``` 102-user-management-lesson.el 103-user-management-quiz.el ``` The next topic should use the next unused lesson number and the next unused quiz number. Example: ``` 104-storage-lvm-quotas-lesson.el 105-storage-lvm-quotas-quiz.el ``` Do not use the same number for both lesson and quiz files unless the repository later changes its convention. ## Lesson File Expectations A lesson file should: * use the established numbered filename format * define one interactive lesson function * create a named lesson buffer * insert the lesson content into that buffer * use a split-window layout * open or reuse an `ansi-term` terminal buffer * return focus to the lesson buffer * avoid fragile or undefined variables Avoid this problem: ``` explicit-shell-file-name ``` Use a safer shell fallback pattern based on current repository style, such as: ``` (or shell-file-name (getenv "SHELL") "/bin/sh") ``` The exact buffer names and formatting should follow the highest-numbered current lesson files. ## Quiz File Expectations A quiz file should: * use the established numbered filename format * define one interactive quiz function * call `linuxplus-start-quiz` * pass exactly three arguments: 1. the lesson function symbol 2. the question list 3. the quiz buffer name The expected call shape is: ``` (linuxplus-start-quiz 'linuxplus-NNN-topic-name-lesson '((:type true-false :prompt "..." :answer true)) "*Linux+ Topic Quiz*") ``` Supported question types include: ``` true-false yes-no multiple ``` For multiple-choice questions, inspect `06-linuxplus-quiz-mode.el` and the highest-numbered quiz files to confirm the current format. ## Study Target File The user will maintain: ``` STUDY.md ``` This file contains study priorities, weak areas, missed concepts, and notes from Linux+ book or practice work. Use `STUDY.md` to decide what future lessons and quizzes should reinforce. Prefer paraphrased concepts over exact copyrighted question text. Good format: ``` Missed area: LVM volume groups Correct concept: vgcreate creates a volume group. Exam trap: lvcreate creates a logical volume, not a volume group. ``` ## Current Known Weak Areas Future lessons should prioritize weak areas listed in `STUDY.md`. Previously discussed weak areas included topics such as: ``` systemd and PID 1 GRUB2 LVM quotas and repquota kernel modules SSH configuration precedence /etc/services netfilter bandwidth and network tools permissions and ACLs cron syntax Git Azure Blob Storage container orchestration /etc/securetty cd - nginx as web server/load balancer MongoDB JSON/BSON document model mail filtering and redirection backup and archive tools ``` Do not assume this list is complete. `STUDY.md` is the preferred source. ## How to Continue the Project To add a new topic: 1. Inspect the highest-numbered lesson and quiz files. 2. Inspect `STUDY.md`. 3. Choose the next unused pair of numbers. 4. Create a lesson file: NNN-topic-name-lesson.el 5. Create the matching quiz file: NNN+1-topic-name-quiz.el 6. Keep the lesson and quiz focused on one topic. 7. Save both files in: ~/.emacs.d/lisp/linuxplus/ 8. Tell the user to run: M-x linuxplus-load-all 9. Then tell the user to run the new lesson and quiz functions. ## Assistant Guidance When helping with this project: * Do not create generic Linux+ lessons. * Use `STUDY.md` and the repository structure. * Follow the current Emacs Lisp style from the highest-numbered files. * Keep lesson and quiz files separate. * Continue the numbering scheme. * Do not re-explain solved setup steps unless troubleshooting. * Do not tell the user to manually load files unless the loader is broken. * Prefer practical study progress over redesigning the system. * Remember that the user is trying to study for Linux+, not spend all available time maintaining infrastructure. ## Goal The goal is to help the user make steady Linux+ certification progress through targeted, topic-based, Emacs-integrated lessons and quizzes. ## RECOVERY maintenance update - 2026-07-09 Corrected the firewall review lesson pair to follow the repository numbering and loader conventions. Remove these incorrectly named files: * `linuxplus-lesson-120.el` * `linuxplus-quiz-120.el` Create these replacement files: * `104-firewall-review-lesson.el` * `105-firewall-review-quiz.el` Reason for correction: * `linuxplus-load-all.el` loads numbered Emacs Lisp files. * Lesson and quiz files use consecutive numbers. * The lesson file should be named `NNN-topic-name-lesson.el`. * The quiz file should be named `NNN+1-topic-name-quiz.el`. * Quiz files should call `linuxplus-start-quiz` instead of using their own `read-string` scoring loop. The corrected lesson function is: * `linuxplus-firewall-review-lesson` The corrected quiz function is: * `linuxplus-firewall-review-quiz` Lesson content is based on missed Linux+ firewall book questions: * firewall ACLs * packet inspection * persistent configuration files * stateful firewall review points * `firewall-cmd --runtime-to-permanent` * numbered UFW rules * simple UFW SSH blocking * DenyHosts * Fail2Ban The lesson preserves the real-world note that DenyHosts is strongly associated with `/etc/hosts.deny`, while Fail2Ban commonly blocks through firewall actions. For the book question, memorize the book's expected wording. ## RECOVERY maintenance update - 2026-07-09 Added project-native Emacs Lisp helpers for updating existing files. New file: * `07-linuxplus-update-files.el` Reason: * Hand-written patch hunks proved fragile. * Some updates need to modify existing Markdown files safely. * The helper file is numbered so `linuxplus-load-all` loads it with the rest of the project. * Each update creates a numbered `.bak.N` backup before writing. Important commands: M-x linuxplus-update-help M-x linuxplus-apply-firewall-score-update M-x linuxplus-update-replace-section-with-region M-x linuxplus-update-insert-region-before-heading The firewall score updater modifies `STUDY.md` by: * replacing the `## Weak Area: Firewall Review` section * setting its status to `Solid` * inserting the 20/20 score note before `## Current Notes` Future assistants should prefer these project update helpers over hand-written shell patch hunks when updating existing project files.