Minimal Bash-based command-line practice for the U.S. Naturalization Civics Test.
- Uses the USCIS 2025 128-question format
- Runs on any Linux distro with Bash and coreutils
- Focuses on simple study and exam workflows
- Multiple choice mode with 4 options per question
- Study mode with instant feedback
- Exam mode with scoring and weak-question tracking
- Main launcher menu with quick commands
- Optional location-based personalization via setup
- Validation script for question file integrity
- Session statistics saved to
.stats.json
uscis-test/
|- uscis.sh # Main menu launcher
|- setup.sh # Download and personalize civics data
|- study_quiz.sh # Study mode
|- exam_quiz.sh # Exam mode
|- validate.sh # File format validator
|- civics.txt # Canonical 128 questions (NUMBER|QUESTION|ANSWER)
|- weak.txt # Incorrect questions from exam sessions
|- .stats.json # Exam statistics history
|- README.md
|- CHANGELOG.md
`- ROADMAP.md
cd ~/uscis-test
chmod +x *.sh
./uscis.shQuick command mode:
./uscis.sh study
./uscis.sh exam
./uscis.sh weak
./uscis.sh stats
./uscis.sh setupRun:
./uscis.shOptions:
- Setup (first run or location refresh)
- Study mode
- Exam mode
- Review weak questions
- View statistics
- Exit
Run:
./study_quiz.shBehavior:
- Choose sequential or random question order
- Answer each question with
1-4 - See instant correct/incorrect feedback
- Press
qto quit at any prompt
Run:
./exam_quiz.shBehavior:
- Choose to clear or append to existing
weak.txt - Answer each question with
1-4 - Automatic score and percentage at the end
- Incorrect questions are saved to
weak.txt - Session stats are appended to
.stats.json
Recommended:
./uscis.sh weakThis uses automatic backup/restore of civics.txt and is safer than manual copy/paste.
Manual workflow (if needed):
cp civics.txt civics.txt.backup
cp weak.txt civics.txt
./study_quiz.sh
cp civics.txt.backup civics.txtRun:
./setup.shWhat setup does:
- Downloads USCIS 2025 PDF and builds
civics.txt - Fetches current congressional/state data
- Updates location-sensitive questions (state, district, officials)
- Uses
.cache/with a 7-day TTL for state data
Validate canonical civics file:
./validate.shValidate any other pipe-delimited file:
./validate.sh weak.txtValidation rules:
- All files: must be
NUMBER|QUESTION|ANSWER civics.txtandcivics.txt.tmp: must have exactly 128 lines and sequential numbering
Study and exam scripts:
- Bash 4+
- coreutils (
cat,wc,shuf,awk,grep)
Setup script only:
curlpython3- Python packages:
pypdf,pyyaml(auto-installed when possible)
Missing civics.txt:
./setup.shMissing shuf:
# Debian/Ubuntu
sudo apt install coreutils
# Fedora/RHEL/Rocky
sudo dnf install coreutils
# Arch
sudo pacman -S coreutils
# openSUSE
sudo zypper install coreutils
# Alpine
sudo apk add coreutilsMIT License. See LICENSE.