Bash

The standard shell on Linux and macOS, used for commands and scripts.

Bash (Bourne Again Shell) is the command interpreter on most Linux systems and macOS. You use it to run commands, automate repetitive tasks and tie other programs together in scripts.

  • Beginner
  • 8 lessons
  • 3 exercises
Not started yet0 of 3 exercises solved
Start lesson 1

Lessons

  1. Your First ScriptA Bash script is a text file of commands. You will write one, make it executable and run it, and see how the shebang line tells the system which interpreter to use.1 exercise
  2. Variables & InputLearn how to store values in variables, do arithmetic and read input. In Bash every variable is a string, so arithmetic needs its own syntax.
  3. Control FlowLearn if statements and loops in Bash. The [ ... ] in a condition is actually a command (test), which is why the spaces inside it are required.
  4. FunctionsLearn to group commands into reusable functions. Bash functions work differently from most languages: they report success with an exit code and pass data back through standard output.
  5. Working with FilesLearn to read, write, copy and search files, and to process text with grep, sed and awk. Most everyday shell work is file work.1 exercise
  6. Pipes & RedirectionLearn to send a command's output to a file or into another command. Pipes let you combine small tools into one useful command.1 exercise
  7. Mini Project: Backup ScriptPut the earlier lessons together in a backup script that compresses a directory, keeps the last few backups and logs what it did.
  8. Bash CheatsheetDaily commands and scripting syntax on one page.

Install it on your own computer

Bash is already installed on Linux and macOS. On Windows, use WSL2 for a full Linux environment or Git Bash for a lighter option.

Bash
# Option 1: WSL2 (recommended — real Linux environment)
wsl --install          # install WSL2 + Ubuntu
wsl                    # start a Linux shell

# Option 2: Git Bash (lightweight, comes with Git)
# Download Git from git-scm.com — includes Git Bash

# Check which shell:
echo $BASH_VERSION

# Windows Terminal is a great terminal emulator:
winget install Microsoft.WindowsTerminal

What people build with Bash

Learn the basics first, then pick up these tools when a project needs them.

Practical uses

  • Automate development and server operations
  • Compose Unix tools into data pipelines
  • Write CI and deployment scripts
  • Manage files, processes, and environments

Projects to try

  1. Backup script
  2. Project scaffolder
  3. Log-analysis pipeline
  4. Zero-downtime deployment script

Common tools and packages

ShellCheckshfmtBatsfzfjqripgrepGNU coreutilsTaskfile

Well-known software

Docker entrypointsGit hooksCI pipelinesLinux installersHomebrew formula scriptsServer bootstrap scripts