Bash
Bash is the default command-line shell on most Linux distributions and macOS. It interprets commands, manages processes, and provides a scripting language for automating system administration tasks, file manipulation, and pipeline orchestration.
itLinux | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Bash
Bash is a command interpreter and a programming language. You type a command, and it runs a program. You place a sequence of commands in a script (a plain text file that Bash executes from top to bottom), and it repeats that work for you, branching on what succeeded, looping over data, and calling named functions. That is the whole trick; the rest is learning which stage of the pipeline changed your words before the program saw them.
Before Bash there was the Bourne shell, which handled both jobs with far less grace. It interpreted commands and scripted them, but interactively the terminal behaved like a typewriter rather than an editor. Bash grew out of that line, adopting command-line editing and history from Emacs, and then grew further into a serious language with arrays, regex matching, and key-value structures. Understanding that it is a descendant rather than a fresh start explains why so much of the syntax feels familiar and why so much of the behavior defends decisions made decades ago.
The idea everything hangs off is the processing order. Bash reads your input, splits it into tokens, parses commands, performs expansion (turning syntax into values, filenames, and captured command output), applies redirection (wiring standard streams to files and into pipelines), runs the command, and collects an exit status (zero for success, nonzero for failure) that conditionals use directly. A wildcard becomes many filenames somewhere in that sequence; a variable becomes several arguments; and most shell surprises are explained simply by locating the stage that changed your text.
The second idea is that quoting is the steering wheel for that machinery. Single quotes preserve every enclosed character literally. Double quotes allow selected expansions while keeping the result as one argument. An unquoted variable splits on whitespace and expands as filenames before the command reads it, which is exactly why "$@" stays the only reliable way to forward a script's arguments without losing their boundaries. Quoting is not style; it is the mechanism that decides whether a line with a space arrives as one filename or as three arguments.
The thing that will surprise you is that the shell and Bash are not synonyms on many machines. Several systems point /bin/sh at dash, a fast minimal interpreter that implements only the POSIX portable subset, so a script using Bash's arrays or =~ regex breaks under that name. The portability decision is therefore not trivia: declare the interpreter your script actually needs, keep POSIX-only scripts within the smaller language, and test with the real interpreter rather than assuming.
The intro gives you the full path from typed text to a running program. The slides map the processing order at a glance. The cheatsheet holds the syntax you will reach for most. Field notes carries the judgment calls, the edge cases and tradeoffs, that the standard teaching path tends to glide past.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.gnu.org/software/bash/
Supports
- Bash as the GNU Project shell and a largely sh-compatible shell
- Bash features for interactive and programming use
- Official routes to releases, documentation, support, and development
- Rationale for the GNU Bash Project link
- https://www.gnu.org/software/bash/manual/bash.html
Supports
- Bash as both command interpreter and programming language
- Builtins, parameters, expansions, redirections, command execution, and control flow
- Interactive features including history, job control, aliases, and command-line editing
- Bash relationship to sh and its POSIX conformance intent
- Complete-manual link rationale and quiz answers about Bash roles and suitable boundaries
- https://www.gnu.org/software/bash/manual/html_node/Shell-Operation.html
Supports
- Ordered command processing from input through status collection
- Tokenization, parsing, expansion, redirection, and execution mental model
- Shell Operation link rationale
- https://www.gnu.org/software/bash/manual/html_node/Quoting.html
Supports
- Quoting as control over special character and word meaning
- Escape, single-quote, double-quote, and dollar-single-quote mechanisms
- Quoting link rationale and quiz answer about quoted parameter expansion
- https://www.gnu.org/software/bash/manual/html_node/Shell-Expansions.html
Supports
- Expansion order and expansion families
- Word splitting, filename expansion, and quote removal
- Parameter, command, and arithmetic expansion anchors
- Shell Expansions link rationale
- https://www.gnu.org/software/bash/manual/html_node/Redirections.html
Supports
- Input, output, append, standard-error, and descriptor redirections
- Redirections processed from left to right
- Here documents, here strings, and descriptor duplication
- Redirections link rationale and redirection-order quiz answer
- https://www.gnu.org/software/bash/manual/html_node/Pipelines.html
Supports
- Pipeline connection from one command's output to the next command's input
- Default pipeline status and pipefail behavior
- Pipeline execution environments and foreground waiting behavior
- Quiz answers about pipeline data flow and status
- https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html
Supports
- Zero as success and nonzero as failure
- Status range and special 126 and 127 meanings
- Last status available through the question-mark special parameter
- Status-based conditional design and related quiz answers
- https://www.gnu.org/software/bash/manual/html_node/Shell-Scripts.html
Supports
- Scripts as text files containing shell commands
- Non-interactive execution, positional parameters, execute bits, and interpreter lines
- Explicit Bash invocation and environment-based interpreter lookup idiom
- Shell Scripts link rationale and interpreter-policy quiz answer
- https://www.gnu.org/software/bash/manual/html_node/Bash-Startup-Files.html
Supports
- Login, interactive non-login, and non-interactive startup behavior
- Interactive non-login reading of the user bash configuration file
- Quiz answer about startup files
- https://www.gnu.org/software/bash/manual/html_node/Arrays.html
Supports
- One-dimensional indexed and associative Bash arrays
- Array declaration, assignment, indexing, and quoted at expansion
- Quiz answer about declaring Bash for Bash-specific array use
- https://www.gnu.org/software/bash/manual/html_node/Bash-Conditional-Expressions.html
Supports
- File, string, and arithmetic conditional expressions
- Behavior of expressions inside double-bracket conditionals
- Quiz answer about Bash-specific conditional syntax
- https://www.gnu.org/software/bash/manual/html_node/Bourne-Shell-Builtins.html
Supports
- Current-shell behavior of builtins including change directory, export, source, and exit
- Export marking names for subsequently executed command environments
- Quiz answer about why change directory is a builtin
- https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
Supports
- Shell option behavior for nounset, errexit, tracing, and pipefail
- Limits and context sensitivity of option-based error handling
- https://en.wikipedia.org/wiki/Bourne_shell
Supports
- Bourne shell shipped with Unix V7 c. 1979 and established the sh family syntax
- https://tiswww.case.edu/php/chet/bash/bashtop.html
Supports
- Documents Bash's origin: Brian Fox began it in 1988 and Chet Ramey maintains it
- https://www.ibm.com/docs/en/aix/7.1?topic=shells-korn-shell
Supports
- KornShell as a POSIX-minded shell that shaped the modern shell standard
- https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html
Supports
- The POSIX shell and utilities standard that sets the portable sh contract
- https://www.gnu.org/software/bash/manual/html_node/Introduction.html
Supports
- GNU Bash manual introduction covering Bash 2.0 and POSIX compliance
- https://tiswww.case.edu/php/chet/bash/FAQ
Supports
- The Bash FAQ documenting version series 2.x, 3.x, and 4.x feature evolution
- https://manpages.debian.org/testing/dash/dash.1.en.html
Supports
- dash (Debian Almquist shell) chosen as /bin/sh for speed on Debian
- https://zsh.sourceforge.io/FAQ/zshfaq01.html
Supports
- zsh FAQ documenting its rise alongside Bash as a modern login shell
- https://tiswww.case.edu/php/chet/bash/bashref.html
Supports
- The Bash Reference Manual resolving Bash extensions from the smaller POSIX sh language
- https://mywiki.wooledge.org/WordSplitting
Supports
- Explains the shell's default word splitting on unquoted expansions
- https://mywiki.wooledge.org/BashFAQ/105
Supports
- BashFAQ 105 on where set -e (errexit) does and does not abort
- https://mywiki.wooledge.org/Quotes
Supports
- Explains quoting as the boundary that controls splitting and globbing
- https://mywiki.wooledge.org/BashFAQ/082
Supports
- BashFAQ 082 explaining why $() command substitution is preferred to backticks
