This guide is an introduction to basic and advanced concepts of the bash shell.
It teaches both newcomers and long-time users the best, safest and most robust ways of writing powerful bash scripts as well as making efficient and speedy interactive use of the shell.
This guide has gone through several iterations and is the result of a severe lack of consistent, clear and reliable language on the topic on the rest of the Internet as well as the public library or book stores.
The primary author and maintainer of this guide is lhunath (Maarten Billemont).
This guide is open source, licensed under Creative Commons Attribution-ShareAlike 4.0 International License (CC-BY-SA). The source code is available at GitHub. Go there to report issues or fork the guide to contribute changes (big or small). To keep up to date with new chapters or improvements to this guide, you could star the GitHub project.
For advice, comments, suggestions, corrections or recommendations, contact lhunath, file an issue or visit the freenode.org #bash community on IRC.
After introducing new practical concepts, the guide offers a set of exercises to allow you to practice your new knowledge. For a summary of all exercises in this guide, see our exercises index.
An introduction to bash, installing and starting it; the terminal, the keyboard and the display; programs, processes and how their flow of information is connected.
About what a command is, and how to issue them; interactive mode and scripts; command syntax, searching commands and programs by name; arguments and word splitting as well as input and output redirection.
Bash parameters and variables; environment variables, special parameters and array parameters; expanding parameters, expansion operators, command substitution and process substitution; pathname expansion, tilde expansion and brace expansion.
Exit codes, success and failure, testing files, strings and numbers, handling different conditions, conditional operators and conditional compound commands.
Iterating commands using for loops, while and until loops, select statements and grouping them in functions.
About jobs, asynchronous commands, job control, process identifiers and signals, process management, inter-process communications.
Terminals and terminal sequences, terminal identifiers, terminfo and terminal capabilities, outputting colors, moving the cursor and querying the terminal's state.
Prompting, prompt commands and the DEBUG signal, readline, bind and input modes and hotkeys, programmatic command completion.