Part 5: Challenge Solutions & Next Steps
Table of Contents
Solutions to all workshop challenges and your path forward These are complete solutions to all workshop challenges. Make sure you’ve attempted each challenge on your own before looking at the solutions. The learning happens in the struggle! Create this directory structure: Approach 1: Step-by-step Approach 2: Efficient (one-liner approach) Approach 3: Using brace expansion Mistake 1: Forgetting Mistake 2: Wrong location Analyze Question 1: How many total requests? Question 2: How many 404 errors? Question 3: List all unique IP addresses Question 4: Which IP made the most requests? Question 5: Show only successful requests (HTTP 200) Using awk for Question 4: Using grep -o for IP extraction: Step 1: Set permissions for hello.sh Step 2: Set permissions for backup.sh Step 3: Set permissions for secret.sh Step 4: Create sysinfo.sh Alternative sysinfo.sh with better formatting: Step 5: Make sysinfo.sh executable Test it: Permission number breakdown: Common combinations: Using symbolic notation: Mistake 1: Forgetting the shebang Mistake 2: Wrong permission order Step 1: Backup your config Step 2: Add aliases and function Step 3: Save and reload In nano: Step 4: Test everything Here’s a complete section to add to your Issue 1: Changes don’t persist Issue 2: Aliases don’t work in scripts Issue 3: mkcd doesn’t work To verify all your solutions work: Congratulations on completing the workshop! Here’s your path forward: Daily Usage: Use the terminal for everyday tasks OverTheWire Bandit: Complete levels 0-15 Customize Further: Bash Scripting: Text Processing Masters: Version Control: Multiplexing: Editor Mastery: Choose one Remote Work: Systems Administration: Modern Tools: Interactive Learning: Documentation: Communities: The command line is not about memorizing commands. It’s about: Remember: Even experienced developers: The difference is they know what to search for and what’s possible. The skills you’ve learned will serve you throughout your career. Every time you: You’ll use these command-line skills. Keep practicing. Keep exploring. Keep building. Completed the workshop? Share it! You’ve graduated from beginner to capable terminal user. The terminal is no longer intimidating - it’s your powerful tool. Keep practicing, keep customizing, and most importantly - have fun automating things! Drop a comment below or reach out: Happy hacking!Navigation
Part 1 Solution: Build a Project Structure
The Challenge
~/workshop-challenges/web-project/
├── src/
│ ├── components/
│ │ ├── Header.js
│ │ └── Footer.js
│ └── styles/
│ └── main.css
├── public/
│ └── index.html
├── tests/
│ └── app.test.js
└── README.md
Complete Solution
# Start from home directory
# Create root directory
# Create all directories
# Create files
# Verify
&& \
&& \
&& \
# Create directories with brace expansion
# Create files with brace expansion
What You Learned
mkdir -p to create nested directories{a,b,c} for efficiencytouchcdCommon Mistakes
-p flag# Make sure you're in the right place
# Check current directory
Part 2 Solution: Web Server Log Analysis
The Challenge
sample-data/server.log and answer 5 questions.Complete Solution
# Output: 8 sample-data/server.log
# Or just the number:
# Output: 8
|
# Output: 2
# Alternative:
# Output: 2
|
# Output:
# 192.168.1.1
# 192.168.1.2
# 192.168.1.3
# 192.168.1.4
# To count them:
| |
# Output: 4
| | | |
# Output: 4 192.168.1.1
# More readable format:
| | | | |
# Output: 192.168.1.1 (4 requests)
# Output: All lines with status 200
# Count them:
# Output: 5
Complete answers.txt File
# Create answers.txt
Explanation of Commands
cut -d' ' -f1-d' ': Use space as delimiter-f1: Extract first field (the IP address)sort | uniq -csort: Sort lines (required for uniq)uniq -c: Count unique occurrencessort -rn-r: Reverse (highest first)-n: Numeric sorthead -1Alternative Solutions
| | | |
| |
What You Learned
cutuniq -csort -ngrepPart 3 Solution: Script Setup & Execution
The Challenge
hello.sh executable (only for you)backup.sh readable and executable by everyonesecret.sh readable and writable only by yousysinfo.sh that displays system informationsysinfo.sh executableComplete Solution
# Verify
# Output: -rwx------ ... hello.sh
# Verify
# Output: -rwxr-xr-x ... backup.sh
# Verify
# Output: -rw------- ... secret.sh
# Verify
# Output: -rwxr-xr-x ... sysinfo.sh
# Or if ~/scripts is in PATH:
Understanding Permissions
rwx rwx rwx = 777
421 421 421
Owner Group Others
700 = rwx—— (Only owner has full access)755 = rwxr-xr-x (Owner full, others read+execute)644 = rw-r–r– (Owner read+write, others read only)600 = rw—–– (Only owner read+write)400 = r–––– (Only owner read, cannot modify)Alternative Permission Methods
# hello.sh - only user executable
# Or:
# backup.sh - everyone can read and execute
# Or:
# secret.sh - only user read/write
What You Learned
<<)Common Mistakes
# Wrong:
# Correct:
# Remember: owner, group, others
Part 4 Solution: Environment Customization
The Challenge
mkcd functionComplete Solution
# Or for zsh:
# Open your config file
# Scroll to the end and add:
# Workshop Aliases
# Change to ~/.zshrc if using zsh
# Create directory and enter it
Ctrl+O, Enter, Ctrl+X
# Or for zsh:
# Test ll
# Should show detailed listing
# Test gs
# Should show git status or error if not in git repo
# Test dev
# Should show: /home/yourusername/workshop-challenges
# Test mkcd
# Should show: /home/yourusername/test-directory
# Test reload
# Should output: works
Complete .bashrc Addition
.bashrc:# =====================================
# Workshop Customizations
# =====================================
# Required aliases
# Determine which config file to reload
if [; then
elif [; then
fi
# Useful function: make directory and change into it
# =====================================
# End Workshop Customizations
# =====================================
Bonus: Additional Useful Customizations
# Navigation
# Go to previous directory
# Listing variations
# Sort by time, newest last
# Sort by size
# Safety nets
# Git shortcuts
# System info
# Quick edits
# Networking
# Utility functions
# Create backup of file
# Find process by name
# Make directory and create .gitkeep
What You Learned
.bashrc and .zshrcCommon Issues and Fixes
# Make sure you're editing the right file
# For bash:
# For zsh:
# Aliases only work in interactive shells
# Use functions instead for scripts:
# In script (functions work):
# Not in script (aliases don't work):
# Won't work in script
# Make sure function syntax is correct:
# Not:
Verification
# Clone the workshop repo
# Run all verifications
&&
&&
&&
&&
What’s Next?
Immediate Practice (This Week)
Deepen Your Skills (Next Month)
sed for find-and-replaceawk for data processingAdvanced Topics (2-3 Months)
tmux or screensystemd: Service managementcron: Task schedulingjournalctlfzf: Fuzzy finderripgrep: Better grepbat: Better catexa: Modern lszoxide: Smart cdPractice Resources
man bash - Your best friendFinal Thoughts
man pages constantlyKeep Learning
Share Your Progress
.bashrc configurationsQuestions or Feedback?