What is Bash shell scripting?
A shell script is a text file of commands that Bash runs in order. Scripts back up databases, deploy apps, clean logs, set up servers and glue tools together.
Bash skills are expected of DevOps engineers, system administrators, backend developers, data engineers and security analysts. Even with modern tools, almost every CI pipeline and container entrypoint runs shell commands.
How to use this Bash Shell Scripting roadmap
Practise on Linux, macOS, WSL on Windows or a cloud VM. Keep a folder of your own scripts and improve them over time.
Automate something you do every week as you learn. Real use teaches faster than exercises.
1Step 1: Command line essentials
Get fluent at the prompt first.
What is it?
Learn navigation, files, permissions, processes and getting help.
What to learn
Read man pages and use –help. They are faster than searching once you get used to them.
Learn each topic here
Navigation and files
pwd, ls, cd, cp, mv, rm, mkdir and find.
Why it matters: Daily work.
Permissions
chmod, chown and the rwx model.
Why it matters: Scripts must be executable.
Processes
ps, top, kill, jobs and background tasks.
Why it matters: Manage running work.
Environment
PATH, environment variables and dotfiles.
Why it matters: Why commands are found or not.
Getting help
man, –help and tldr.
Why it matters: Self-reliance.
Example
bash
find /var/log -name "*.log" -mtime +7 -size +10M -ls
chmod +x backup.sh
echo "$PATH" | tr ":" "\n"Finding large old logs, making a script executable and listing PATH entries.
Helpful resource: Linux Journey
2Step 2: Pipes, redirection and text tools
The Unix superpower.
What is it?
Pipes send one command’s output to another. Combined with grep, sort, cut and friends, you can process data without writing a program.
What to learn
Build pipelines step by step, checking output after each new command.
Learn each topic here
Redirection
>, >>, 2>, &> and input redirection.
Why it matters: Save output and errors.
Pipes
Chain commands with |.
Why it matters: Small tools, big results.
grep
Search text with patterns.
Why it matters: Find anything in logs.
sort, uniq, cut, wc
Count, group and slice text.
Why it matters: Quick reports.
xargs and tee
Pass output as arguments; split output to file and screen.
Why it matters: Flexible pipelines.
Example
bash
# Top 10 IPs hitting the server today
grep "$(date +%d/%b/%Y)" access.log | awk '{print $1}' | sort | uniq -c | sort -rn | headA one-line log report using a pipeline.
Helpful resource: GNU Coreutils manual
3Step 3: Scripting basics
Turn commands into reusable scripts.
What is it?
Learn the shebang, variables, quoting, arguments, conditionals, loops and functions.
What to learn
Always quote variables: "$var". Unquoted variables cause most beginner bugs.
Learn each topic here
Shebang and running scripts
#!/usr/bin/env bash and chmod +x.
Why it matters: Scripts run anywhere.
Variables and quoting
Assignment, expansion, single versus double quotes.
Why it matters: Avoid word-splitting bugs.
Arguments
$1, $@, $# and shift.
Why it matters: Flexible scripts.
Conditionals and tests
if, [[ ]], file tests and string comparison.
Why it matters: Decisions in scripts.
Loops and functions
for, while and reusable functions.
Why it matters: Less repetition.
Example
bash
#!/usr/bin/env bash
backup_dir() {
local src="$1" dest="$2"
[[ -d "$src" ]] || { echo "No such dir: $src" >&2; return 1; }
tar -czf "$dest/$(basename "$src")-$(date +%F).tar.gz" "$src"
}
for d in "$@"; do backup_dir "$d" /backups; doneA backup script with a function, argument loop and error message.
Helpful resource: Bash Guide (Greg’s Wiki)
4Step 4: Text processing with sed and awk
Edit and analyse text at speed.
What is it?
sed edits streams of text; awk is a small language for column-based data. Together with regular expressions they handle most text tasks.
What to learn
Learn regular expressions properly once. They pay off in every language and tool.
Learn each topic here
Regular expressions
Patterns for matching text.
Why it matters: Used by grep, sed and awk.
sed
Find and replace, delete lines and in-place edits.
Why it matters: Bulk file changes.
awk
Fields, conditions and sums.
Why it matters: Reports from structured text.
jq
Query and transform JSON.
Why it matters: APIs and cloud tools output JSON.
CSV handling
Simple CSV with awk; use proper tools for complex files.
Why it matters: Common data format.
Example
bash
# Sum the amount column (3rd) for Dubai rows in a CSV
awk -F, '$2 == "Dubai" { total += $3 } END { printf "AED %.2f\n", total }' sales.csv
# Get running instance IDs from AWS CLI JSON
aws ec2 describe-instances | jq -r '.Reservations[].Instances[] | select(.State.Name=="running") | .InstanceId'awk for CSV totals and jq for JSON.
Helpful resource: jq manual
5Step 5: Robust scripts
Write scripts others can trust.
What is it?
Production scripts handle errors, clean up after themselves, log clearly and pass static checks.
What to learn
Run ShellCheck on every script. It catches real bugs in seconds.
Learn each topic here
Strict mode
set -euo pipefail and its trade-offs.
Why it matters: Fail fast instead of silently.
Traps and clean-up
trap to remove temp files on exit.
Why it matters: No leftovers.
Logging and exit codes
Clear messages and meaningful return codes.
Why it matters: Easier debugging and automation.
ShellCheck
Static analysis for shell scripts.
Why it matters: Catches common mistakes.
Option parsing
getopts and usage messages.
Why it matters: Professional command-line tools.
Example
bash
#!/usr/bin/env bash
set -euo pipefail
tmp=$(mktemp -d)
trap 'rm -rf "$tmp"' EXIT
log() { echo "[$(date +%T)] $*" >&2; }
log "Downloading report"
curl -fsS "$REPORT_URL" -o "$tmp/report.csv"
log "Done: $(wc -l < "$tmp/report.csv") lines"Strict mode, automatic clean-up and timestamped logging.
Helpful resource: ShellCheck
6Step 6: Automation in production
Expert level: scripts as part of real systems.
What is it?
At this level scripts run on schedules, in CI pipelines and containers, across many servers, and you know when to switch to Python or a config tool.
What to learn
If a script passes 200 lines or needs complex data structures, consider rewriting it in Python.
Learn each topic here
cron and systemd timers
Run scripts on schedules.
Why it matters: Hands-off automation.
CI/CD scripts
Build, test and deploy steps in pipelines.
Why it matters: Every pipeline uses shell.
Container entrypoints
Start-up scripts that configure and launch apps.
Why it matters: Reliable containers.
Remote automation
SSH loops, parallel runs and Ansible ad-hoc commands.
Why it matters: Manage many servers.
Testing shell scripts
bats-core for unit tests.
Why it matters: Safe changes.
Example
bash
# /etc/systemd/system/backup.timer
[Timer]
OnCalendar=*-*-* 02:30:00
Persistent=true
# Run on many servers in parallel
parallel -j 10 ssh {} "sudo systemctl status nginx --no-pager" ::: $(cat hosts.txt)A nightly systemd timer and a parallel health check across servers.
Helpful resource: bats-core
Bash Shell Scripting roadmap project ideas
Keep all scripts in a public dotfiles or tools repo with READMEs and tests.
Shell setup
Aliases, prompt and a cheat sheet.
Log report
One-line pipelines on a web log.
Backup tool
Compression, rotation and error handling.
Data report
CSV and JSON processing with awk and jq.
Server health checker
Checks disk, memory and services, then alerts.
Production automation
Tested scripts on timers and CI across servers.
Tips to finish this Bash scripting roadmap
- Quote everything. Most shell bugs are unquoted variables.
- Use ShellCheck. Free, fast and accurate.
- Test on copies. Never try new rm or sed commands on real data first.
- Know when to stop. Switch to Python for complex logic.
Career paths and next steps
Bash skills support DevOps, SRE, system administration, cloud, security and data engineering roles. They are tested in many technical interviews for infrastructure jobs.
Next, learn Linux administration deeply, then Python and Ansible for larger automation.
Related roadmaps
Bash Shell Scripting Roadmap FAQs
Is Bash still worth learning?
Yes. It runs on nearly every server, container and CI system.
How long does it take to learn Bash scripting?
A few weeks for basics and 2 to 4 months to write robust production scripts.
Bash or Python for automation?
Bash for gluing commands and quick tasks; Python for complex logic and data.
Does Bash work on Windows?
Yes, through WSL or Git Bash.