dargslan-sysadmin-quiz 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +63 -0
- package/index.js +137 -0
- package/package.json +21 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dargslan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# ⚙️ Dargslan SysAdmin Quiz
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/dargslan-sysadmin-quiz)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
**Interactive Linux System Administration quiz right in your terminal.** Test your knowledge of systemd, LVM, RAID, networking, users, permissions, backup, monitoring, and more.
|
|
7
|
+
|
|
8
|
+
## Quick Start
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx dargslan-sysadmin-quiz
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
No installation needed — just run and play!
|
|
15
|
+
|
|
16
|
+
## Features
|
|
17
|
+
|
|
18
|
+
- 🎯 **40+ expert questions** across 6 categories
|
|
19
|
+
- ⚙️ **Systemd & Services** — unit files, timers, journalctl
|
|
20
|
+
- 💾 **Storage & LVM** — LVM, RAID, filesystems, fstrim
|
|
21
|
+
- 👤 **Users & Permissions** — PAM, umask, sudo, shadow
|
|
22
|
+
- 🌐 **Networking** — ip, routing, bonding, sysctl
|
|
23
|
+
- 📊 **Monitoring & Logs** — top, sar, journalctl, /proc
|
|
24
|
+
- 🔄 **Backup & Recovery** — rsync, tar, LVM snapshots, BorgBackup
|
|
25
|
+
- 🏆 **4 game modes** — Quick, Full, By Category, Speed Round
|
|
26
|
+
- ★☆☆ to ★★★ difficulty levels
|
|
27
|
+
- 💡 Detailed explanations after each answer
|
|
28
|
+
- 📖 Personalized book recommendations based on your score
|
|
29
|
+
- 🚀 Zero dependencies — works everywhere Node.js runs
|
|
30
|
+
|
|
31
|
+
## Game Modes
|
|
32
|
+
|
|
33
|
+
| Mode | Questions | Description |
|
|
34
|
+
|------|-----------|-------------|
|
|
35
|
+
| Quick Quiz | 10 | Random selection for a fast test |
|
|
36
|
+
| Full Challenge | 40 | All questions, prove your mastery |
|
|
37
|
+
| By Category | Varies | Focus on your weak areas |
|
|
38
|
+
| Speed Round | 15 | 15 seconds per question! |
|
|
39
|
+
|
|
40
|
+
## Who Is This For?
|
|
41
|
+
|
|
42
|
+
- 🎓 **RHCSA/LFCS/LPIC** certification candidates
|
|
43
|
+
- 💼 **Job interview** preparation
|
|
44
|
+
- 🖥️ **System administrators** wanting to stay sharp
|
|
45
|
+
- 📚 **Students** learning Linux administration
|
|
46
|
+
|
|
47
|
+
## More Quizzes
|
|
48
|
+
|
|
49
|
+
- 🐧 `npx dargslan-linux-quiz` — General Linux
|
|
50
|
+
- 🐳 `npx dargslan-devops-quiz` — Docker, K8s, Terraform
|
|
51
|
+
- 🔒 `npx dargslan-security-quiz` — Cybersecurity
|
|
52
|
+
- 📖 `npx linux-cheatsheet-cli` — Command Reference
|
|
53
|
+
- 🛡️ `npx server-hardening-checklist` — Security Audit
|
|
54
|
+
|
|
55
|
+
## Learn More
|
|
56
|
+
|
|
57
|
+
- 📚 [210+ IT eBooks](https://dargslan.com/books)
|
|
58
|
+
- 📄 [260+ Cheat Sheets](https://dargslan.com/cheat-sheets)
|
|
59
|
+
- 📝 [IT Blog](https://dargslan.com/blog)
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT — [dargslan.com](https://dargslan.com)
|
package/index.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const readline = require('readline');
|
|
4
|
+
|
|
5
|
+
const c = {
|
|
6
|
+
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
7
|
+
red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
|
|
8
|
+
blue: '\x1b[34m', magenta: '\x1b[35m', cyan: '\x1b[36m', white: '\x1b[37m',
|
|
9
|
+
bgGreen: '\x1b[42m', bgRed: '\x1b[41m',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const CATEGORIES = [
|
|
13
|
+
{ name: 'Systemd & Services', icon: '⚙️' },
|
|
14
|
+
{ name: 'Storage & LVM', icon: '💾' },
|
|
15
|
+
{ name: 'Users & Permissions', icon: '👤' },
|
|
16
|
+
{ name: 'Networking', icon: '🌐' },
|
|
17
|
+
{ name: 'Monitoring & Logs', icon: '📊' },
|
|
18
|
+
{ name: 'Backup & Recovery', icon: '🔄' },
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const QUESTIONS = [
|
|
22
|
+
{ category: 0, difficulty: 1, question: 'Which command starts a systemd service?', options: ['systemctl start SERVICE', 'service start SERVICE', 'init start SERVICE', 'daemon start SERVICE'], answer: 0, explanation: '`systemctl start SERVICE` starts a service. Use `enable` to make it start at boot.' },
|
|
23
|
+
{ category: 0, difficulty: 1, question: 'How do you check the status of a service?', options: ['service --check', 'systemctl status SERVICE', 'ps SERVICE', 'init status'], answer: 1, explanation: '`systemctl status SERVICE` shows whether a service is running, its PID, and recent logs.' },
|
|
24
|
+
{ category: 0, difficulty: 2, question: 'What does `systemctl enable --now SERVICE` do?', options: ['Disables the service', 'Enables at boot AND starts it immediately', 'Only enables at boot', 'Restarts the service'], answer: 1, explanation: 'The `--now` flag combines `enable` (boot persistence) with `start` (immediate start).' },
|
|
25
|
+
{ category: 0, difficulty: 2, question: 'Where are systemd unit files typically located?', options: ['/etc/init.d/', '/etc/systemd/system/', '/var/systemd/', '/opt/services/'], answer: 1, explanation: 'Custom unit files go in `/etc/systemd/system/`. Default ones are in `/usr/lib/systemd/system/`.' },
|
|
26
|
+
{ category: 0, difficulty: 3, question: 'What does `systemctl mask SERVICE` do?', options: ['Hides logs', 'Completely prevents the service from starting', 'Masks the service name', 'Enables stealth mode'], answer: 1, explanation: 'Masking links the unit to /dev/null, making it impossible to start even manually.' },
|
|
27
|
+
{ category: 0, difficulty: 2, question: 'How do you view logs for a specific service?', options: ['cat /var/log/SERVICE', 'journalctl -u SERVICE', 'syslog SERVICE', 'dmesg SERVICE'], answer: 1, explanation: '`journalctl -u SERVICE` shows all journal entries for that systemd unit.' },
|
|
28
|
+
{ category: 0, difficulty: 3, question: 'What is a systemd timer used for?', options: ['Measuring CPU time', 'Scheduling tasks as an alternative to cron', 'Setting system clock', 'Network timeouts'], answer: 1, explanation: 'Systemd timers can replace cron jobs with better logging, dependencies, and control.' },
|
|
29
|
+
{ category: 1, difficulty: 1, question: 'What command shows disk usage in human-readable format?', options: ['disk -h', 'df -h', 'du -h /', 'fdisk -l'], answer: 1, explanation: '`df -h` shows filesystem disk space usage. `du -sh` shows directory sizes.' },
|
|
30
|
+
{ category: 1, difficulty: 1, question: 'Which command lists block devices?', options: ['blocks', 'lsblk', 'lsdev', 'blklist'], answer: 1, explanation: '`lsblk` lists all block devices with their mount points, sizes, and types.' },
|
|
31
|
+
{ category: 1, difficulty: 2, question: 'What does LVM stand for?', options: ['Linux Virtual Memory', 'Logical Volume Manager', 'Linear Volume Mapping', 'Local Volume Mount'], answer: 1, explanation: 'LVM allows flexible disk management — resize, snapshot, and span volumes across disks.' },
|
|
32
|
+
{ category: 1, difficulty: 2, question: 'What is the correct order to create an LVM volume?', options: ['LV -> VG -> PV', 'PV -> VG -> LV', 'VG -> PV -> LV', 'PV -> LV -> VG'], answer: 1, explanation: 'First create Physical Volumes (pvcreate), then Volume Group (vgcreate), then Logical Volumes (lvcreate).' },
|
|
33
|
+
{ category: 1, difficulty: 3, question: 'How do you extend a logical volume and resize the filesystem?', options: ['lvextend -L +10G /dev/vg/lv && resize2fs /dev/vg/lv', 'fdisk --extend', 'resize /dev/vg/lv 10G', 'vgextend +10G'], answer: 0, explanation: '`lvextend` increases the LV size, then `resize2fs` (ext4) or `xfs_growfs` (XFS) expands the filesystem.' },
|
|
34
|
+
{ category: 1, difficulty: 2, question: 'What RAID level provides mirroring?', options: ['RAID 0', 'RAID 1', 'RAID 5', 'RAID 6'], answer: 1, explanation: 'RAID 1 mirrors data across disks for redundancy. RAID 0 is striping (no redundancy).' },
|
|
35
|
+
{ category: 1, difficulty: 3, question: 'What does `fstrim` do on an SSD?', options: ['Formats the drive', 'Sends TRIM commands to reclaim unused blocks', 'Defragments the SSD', 'Checks for errors'], answer: 1, explanation: '`fstrim` informs the SSD which blocks are no longer in use, improving performance and longevity.' },
|
|
36
|
+
{ category: 2, difficulty: 1, question: 'Which command adds a new user?', options: ['adduser', 'useradd', 'Both work', 'newuser'], answer: 2, explanation: 'Both `useradd` (low-level) and `adduser` (interactive wrapper) create users. `useradd -m` creates home dir.' },
|
|
37
|
+
{ category: 2, difficulty: 1, question: 'How do you add a user to the sudo group?', options: ['sudo add user', 'usermod -aG sudo username', 'chmod sudo username', 'grant sudo username'], answer: 1, explanation: '`usermod -aG sudo username` appends the user to the sudo group without removing other groups.' },
|
|
38
|
+
{ category: 2, difficulty: 2, question: 'What does `/etc/shadow` contain?', options: ['User home directories', 'Encrypted passwords and aging info', 'Group memberships', 'Login shells'], answer: 1, explanation: '/etc/shadow stores hashed passwords, password aging, and account expiration data. Only root can read it.' },
|
|
39
|
+
{ category: 2, difficulty: 2, question: 'What does `umask 027` mean?', options: ['Full permissions', 'New files: owner=rwx, group=r-x, others=none', 'Read-only for all', 'Execute only'], answer: 1, explanation: 'umask 027 means new files get 750 (dir) or 640 (file) permissions — no access for others.' },
|
|
40
|
+
{ category: 2, difficulty: 3, question: 'What is PAM in Linux?', options: ['Package Access Manager', 'Pluggable Authentication Modules', 'Permission Assignment Manager', 'Protected Access Mode'], answer: 1, explanation: 'PAM provides flexible, modular authentication. Config files in /etc/pam.d/ control login, sudo, SSH, etc.' },
|
|
41
|
+
{ category: 3, difficulty: 1, question: 'Which file configures static DNS resolution?', options: ['/etc/dns', '/etc/hosts', '/etc/nameserver', '/etc/lookup'], answer: 1, explanation: '/etc/hosts maps hostnames to IP addresses locally, checked before DNS servers.' },
|
|
42
|
+
{ category: 3, difficulty: 1, question: 'What command shows the routing table?', options: ['route show', 'ip route', 'netstat -r', 'Both ip route and netstat -r'], answer: 3, explanation: 'Both `ip route` (modern) and `netstat -r` (legacy) display the routing table.' },
|
|
43
|
+
{ category: 3, difficulty: 2, question: 'What does `ip addr add 192.168.1.10/24 dev eth0` do?', options: ['Removes the IP', 'Assigns an IP address to interface eth0', 'Pings the address', 'Creates a VLAN'], answer: 1, explanation: 'This assigns a static IP address to the eth0 interface. Use `ip addr del` to remove it.' },
|
|
44
|
+
{ category: 3, difficulty: 2, question: 'Where is the DNS resolver configured on most Linux systems?', options: ['/etc/dns.conf', '/etc/resolv.conf', '/etc/named.conf', '/etc/network/dns'], answer: 1, explanation: '/etc/resolv.conf contains nameserver entries that the system uses for DNS resolution.' },
|
|
45
|
+
{ category: 3, difficulty: 3, question: 'What does `sysctl net.ipv4.ip_forward=1` enable?', options: ['Faster networking', 'IP packet forwarding (routing between interfaces)', 'IPv4 only mode', 'Port forwarding'], answer: 1, explanation: 'IP forwarding allows a Linux machine to act as a router, forwarding packets between network interfaces.' },
|
|
46
|
+
{ category: 3, difficulty: 3, question: 'What is a network bond/team?', options: ['VPN tunnel', 'Combining multiple NICs for redundancy/throughput', 'Wireless bridge', 'DNS cluster'], answer: 1, explanation: 'Network bonding/teaming combines multiple interfaces for failover (active-backup) or increased throughput (802.3ad).' },
|
|
47
|
+
{ category: 4, difficulty: 1, question: 'Which command shows system resource usage in real-time?', options: ['sysinfo', 'top', 'resources', 'monitor'], answer: 1, explanation: '`top` (or `htop`) shows real-time CPU, memory, and process information.' },
|
|
48
|
+
{ category: 4, difficulty: 1, question: 'Where are system logs stored?', options: ['/var/log/', '/etc/log/', '/home/logs/', '/sys/log/'], answer: 0, explanation: '/var/log/ contains syslog, auth.log, kern.log, and application-specific log files.' },
|
|
49
|
+
{ category: 4, difficulty: 2, question: 'What does `journalctl --since "1 hour ago"` show?', options: ['Future logs', 'Journal entries from the last hour', 'Disk usage', 'Network stats'], answer: 1, explanation: 'journalctl supports time-based filtering with --since and --until for precise log analysis.' },
|
|
50
|
+
{ category: 4, difficulty: 2, question: 'What tool sends alerts when disk space exceeds a threshold?', options: ['df only', 'Custom script with cron + mail', 'There is no way', 'fswatch'], answer: 1, explanation: 'A cron job running `df` and checking thresholds with mail/sendmail alerts is the classic approach. Modern: Prometheus + Alertmanager.' },
|
|
51
|
+
{ category: 4, difficulty: 3, question: 'What does `sar` (from sysstat) provide?', options: ['Security audit reports', 'Historical system activity data (CPU, memory, I/O, network)', 'Service availability reports', 'Storage analysis'], answer: 1, explanation: '`sar` collects and reports historical system performance data. Essential for capacity planning and troubleshooting.' },
|
|
52
|
+
{ category: 4, difficulty: 3, question: 'What is the purpose of `/proc/loadavg`?', options: ['Shows login history', 'Displays 1/5/15 minute load averages and process counts', 'Lists loaded modules', 'Shows average file sizes'], answer: 1, explanation: 'Load average represents the average number of processes waiting for CPU. Compare against CPU core count.' },
|
|
53
|
+
{ category: 5, difficulty: 1, question: 'Which tool creates compressed archives for backup?', options: ['zip only', 'tar', 'backup', 'archive'], answer: 1, explanation: '`tar -czf backup.tar.gz /path/` creates a compressed archive. Use `-xzf` to extract.' },
|
|
54
|
+
{ category: 5, difficulty: 1, question: 'What does rsync do?', options: ['Resyncs time', 'Efficiently syncs files between locations', 'Resets configurations', 'Restores backups'], answer: 1, explanation: '`rsync -avz` synchronizes files, only transferring changes. Works locally and over SSH.' },
|
|
55
|
+
{ category: 5, difficulty: 2, question: 'What is the 3-2-1 backup rule?', options: ['3 servers, 2 backups, 1 cloud', '3 copies, 2 different media, 1 offsite', '3 daily, 2 weekly, 1 monthly', '3 full, 2 incremental, 1 differential'], answer: 1, explanation: 'The 3-2-1 rule: 3 copies of data, on 2 different media types, with 1 copy offsite.' },
|
|
56
|
+
{ category: 5, difficulty: 2, question: 'What is the difference between incremental and differential backup?', options: ['No difference', 'Incremental: changes since last backup; Differential: changes since last full', 'Differential is faster', 'Incremental is full'], answer: 1, explanation: 'Incremental backs up changes since the last backup (any type). Differential backs up all changes since the last full backup.' },
|
|
57
|
+
{ category: 5, difficulty: 3, question: 'How do you create an LVM snapshot for a consistent backup?', options: ['cp -snapshot', 'lvcreate -s -L 5G -n snap /dev/vg/lv', 'vgsnapshot create', 'dd if=/dev/vg/lv'], answer: 1, explanation: 'LVM snapshots create a point-in-time copy for consistent backups without stopping services.' },
|
|
58
|
+
{ category: 5, difficulty: 3, question: 'What tool provides deduplicating encrypted backups?', options: ['tar', 'rsync', 'BorgBackup (borg)', 'cp'], answer: 2, explanation: 'BorgBackup provides deduplication, encryption, and compression. Also consider restic as an alternative.' },
|
|
59
|
+
{ category: 5, difficulty: 2, question: 'How do you backup a PostgreSQL database?', options: ['cp database', 'pg_dump -U user dbname > backup.sql', 'psql --backup', 'tar /var/lib/postgresql'], answer: 1, explanation: '`pg_dump` creates a logical backup. For large databases, use `pg_dump -Fc` for custom format with compression.' },
|
|
60
|
+
{ category: 0, difficulty: 2, question: 'How do you list all failed systemd services?', options: ['systemctl list-failed', 'systemctl --failed', 'Both work', 'service --failures'], answer: 2, explanation: 'Both `systemctl list-failed` and `systemctl --failed` show services that failed to start.' },
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
const BOOKS = {
|
|
64
|
+
low: [
|
|
65
|
+
{ title: 'Linux for Absolute Beginners', url: 'https://dargslan.com/book/linux-for-absolute-beginners' },
|
|
66
|
+
{ title: 'Linux System Administration for Beginners', url: 'https://dargslan.com/book/linux-system-administration-for-beginners' },
|
|
67
|
+
],
|
|
68
|
+
mid: [
|
|
69
|
+
{ title: 'Linux Administration Fundamentals', url: 'https://dargslan.com/book/linux-administration-fundamentals' },
|
|
70
|
+
{ title: 'Linux System Administration Handbook', url: 'https://dargslan.com/book/linux-system-administration-handbook' },
|
|
71
|
+
],
|
|
72
|
+
high: [
|
|
73
|
+
{ title: 'Linux Performance Tuning', url: 'https://dargslan.com/book/linux-performance-tuning' },
|
|
74
|
+
{ title: 'Linux Troubleshooting Techniques', url: 'https://dargslan.com/book/linux-troubleshooting-techniques' },
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
function shuffle(a){const b=[...a];for(let i=b.length-1;i>0;i--){const j=Math.floor(Math.random()*(i+1));[b[i],b[j]]=[b[j],b[i]];}return b;}
|
|
79
|
+
function ask(rl,q){return new Promise(r=>rl.question(q,a=>r(a.trim())));}
|
|
80
|
+
|
|
81
|
+
async function main(){
|
|
82
|
+
const rl=readline.createInterface({input:process.stdin,output:process.stdout});
|
|
83
|
+
console.log(`\n${c.bold}${c.cyan} ╔══════════════════════════════════════════════════╗`);
|
|
84
|
+
console.log(` ║${c.white} ⚙️ DARGSLAN SYSADMIN QUIZ 💾 ${c.cyan}║`);
|
|
85
|
+
console.log(` ║${c.dim}${c.white} Test your Linux administration knowledge ${c.cyan}║`);
|
|
86
|
+
console.log(` ╚══════════════════════════════════════════════════╝${c.reset}\n`);
|
|
87
|
+
console.log(`${c.dim} Powered by dargslan.com — 210+ IT eBooks${c.reset}\n`);
|
|
88
|
+
|
|
89
|
+
console.log(` ${c.green}[1]${c.reset} Quick Quiz (10) ${c.yellow}[2]${c.reset} Full (40) ${c.cyan}[3]${c.reset} By Category ${c.red}[4]${c.reset} Speed Round\n`);
|
|
90
|
+
const mode=parseInt(await ask(rl,` ${c.bold}Choice [1-4]: ${c.reset}`))||1;
|
|
91
|
+
|
|
92
|
+
let qs;
|
|
93
|
+
if(mode===2)qs=shuffle(QUESTIONS);
|
|
94
|
+
else if(mode===3){
|
|
95
|
+
console.log('');CATEGORIES.forEach((cat,i)=>console.log(` [${i+1}] ${cat.icon} ${cat.name}`));
|
|
96
|
+
const ci=(parseInt(await ask(rl,`\n ${c.bold}Category [1-6]: ${c.reset}`))||1)-1;
|
|
97
|
+
qs=shuffle(QUESTIONS.filter(q=>q.category===ci));
|
|
98
|
+
}else if(mode===4)qs=shuffle(QUESTIONS).slice(0,15);
|
|
99
|
+
else qs=shuffle(QUESTIONS).slice(0,10);
|
|
100
|
+
|
|
101
|
+
if(!qs.length){console.log(' No questions!');rl.close();return;}
|
|
102
|
+
|
|
103
|
+
let correct=0;const labels=['A','B','C','D'];
|
|
104
|
+
for(let i=0;i<qs.length;i++){
|
|
105
|
+
const q=qs[i];const cat=CATEGORIES[q.category];
|
|
106
|
+
const stars=q.difficulty===1?'★☆☆':q.difficulty===2?'★★☆':'★★★';
|
|
107
|
+
const dc=q.difficulty===1?c.green:q.difficulty===2?c.yellow:c.red;
|
|
108
|
+
console.log(`\n${c.dim}${'─'.repeat(60)}${c.reset}`);
|
|
109
|
+
console.log(` ${c.bold}Q${i+1}/${qs.length}${c.reset} | ${cat.icon} ${cat.name} | ${dc}${stars}${c.reset}`);
|
|
110
|
+
console.log(`\n ${c.bold}${q.question}${c.reset}\n`);
|
|
111
|
+
q.options.forEach((o,j)=>console.log(` ${c.cyan}${labels[j]}${c.reset}) ${o}`));
|
|
112
|
+
let ans;
|
|
113
|
+
if(mode===4){
|
|
114
|
+
console.log(`\n ${c.yellow}⏱ 15 seconds!${c.reset}`);
|
|
115
|
+
ans=await Promise.race([ask(rl,`\n ${c.bold}Answer [A-D]: ${c.reset}`),new Promise(r=>setTimeout(()=>r(''),15000))]);
|
|
116
|
+
}else ans=await ask(rl,`\n ${c.bold}Answer [A-D]: ${c.reset}`);
|
|
117
|
+
const ai=labels.indexOf(ans.toUpperCase());
|
|
118
|
+
if(ai===q.answer){correct++;console.log(` ${c.bgGreen}${c.white}${c.bold} ✓ CORRECT ${c.reset}`);}
|
|
119
|
+
else console.log(` ${c.bgRed}${c.white}${c.bold} ✗ WRONG ${c.reset} Answer: ${labels[q.answer]}) ${q.options[q.answer]}`);
|
|
120
|
+
console.log(` ${c.dim}💡 ${q.explanation}${c.reset}`);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const pct=Math.round(correct/qs.length*100);
|
|
124
|
+
const sc=pct>=80?c.green:pct>=60?c.yellow:c.red;
|
|
125
|
+
console.log(`\n${c.bold}${c.cyan} ═══════════ RESULTS ═══════════${c.reset}`);
|
|
126
|
+
console.log(`\n Score: ${sc}${c.bold}${correct}/${qs.length} (${pct}%)${c.reset}\n`);
|
|
127
|
+
|
|
128
|
+
const books=pct>=80?BOOKS.high:pct>=60?BOOKS.mid:BOOKS.low;
|
|
129
|
+
console.log(` ${c.bold}Recommended reading:${c.reset}`);
|
|
130
|
+
books.forEach(b=>console.log(` 📖 ${b.title}\n ${c.cyan}${b.url}${c.reset}`));
|
|
131
|
+
console.log(`\n 📚 210+ IT eBooks: ${c.cyan}https://dargslan.com/books${c.reset}`);
|
|
132
|
+
console.log(` 📄 260+ Cheat Sheets: ${c.cyan}https://dargslan.com/cheat-sheets${c.reset}`);
|
|
133
|
+
console.log(` 📝 IT Blog: ${c.cyan}https://dargslan.com/blog${c.reset}`);
|
|
134
|
+
console.log(`\n${c.dim} Made with ❤ by Dargslan — dargslan.com${c.reset}\n`);
|
|
135
|
+
rl.close();
|
|
136
|
+
}
|
|
137
|
+
main().catch(console.error);
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "dargslan-sysadmin-quiz",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Interactive Linux System Administration quiz in your terminal. 40+ questions on systemd, LVM, RAID, networking, backup, monitoring, and more.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dargslan-sysadmin-quiz": "./index.js",
|
|
8
|
+
"sysadmin-quiz": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"linux", "sysadmin", "system-administration", "quiz", "terminal", "cli",
|
|
12
|
+
"systemd", "lvm", "raid", "networking", "backup", "monitoring",
|
|
13
|
+
"rhcsa", "lpic", "certification", "learning", "practice", "interview"
|
|
14
|
+
],
|
|
15
|
+
"author": "Dargslan <info@dargslan.com> (https://dargslan.com)",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"homepage": "https://dargslan.com",
|
|
18
|
+
"repository": { "type": "git", "url": "https://github.com/Dargslan/dargslan-sysadmin-quiz" },
|
|
19
|
+
"engines": { "node": ">=14.0.0" },
|
|
20
|
+
"files": ["index.js", "README.md", "LICENSE"]
|
|
21
|
+
}
|