openskills.info
Bash logoOpen Course

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

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