# wangdoc/bash-tutorial

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/wangdoc-bash-tutorial).**

4,354 stars · 1,038 forks · Shell

## Links

- GitHub: https://github.com/wangdoc/bash-tutorial
- Homepage: https://wangdoc.com/bash/
- awesome-repositories: https://awesome-repositories.com/repository/wangdoc-bash-tutorial.md

## Description

This project is a comprehensive educational resource consisting of a Bash programming tutorial, scripting reference, and Linux command line manual. It provides instructional materials for writing scripts, automating system tasks, and mastering terminal navigation and Unix system administration.

The guides cover a wide range of shell environment customization, including prompt styling and the use of aliases. It also provides a shell environment guide for managing configuration files and initializing user environments.

The materials detail a broad set of capabilities including control flow logic, data management with indexed and associative arrays, and text processing. Other covered areas include file and resource management, pattern matching with regular expressions, and observability tools for script debugging and syntax validation.

The resource also explains interactive terminal features such as command history retrieval, input completion, and keyboard shortcuts for command line navigation.

## Tags

### Development Tools & Productivity

- [Shell Command Execution](https://awesome-repositories.com/f/development-tools-productivity/shell-command-execution.md) — Provides a comprehensive guide on running programs and system utilities from the Bash command line. ([source](https://wangdoc.com/bash/))
- [Standard Stream Redirection](https://awesome-repositories.com/f/development-tools-productivity/cli-command-frameworks/command-chaining/standard-stream-redirection.md) — Demonstrates how to redirect standard input and output, including the use of here-documents and here-strings.
- [Command Line Argument Parsing](https://awesome-repositories.com/f/development-tools-productivity/command-line-argument-parsing.md) — Explains how to process command-line flags and positional parameters to control script behavior. ([source](https://wangdoc.com/bash/script.html))
- [List Iteration Loops](https://awesome-repositories.com/f/development-tools-productivity/custom-command-execution/scheduled-command-execution/continuous-loop-executions/list-iteration-loops.md) — Teaches how to iterate over lists, wildcard matches, and the output of other commands. ([source](https://wangdoc.com/bash/loop.html))
- [Exit Status Signaling](https://awesome-repositories.com/f/development-tools-productivity/exit-status-reporters/exit-status-signaling.md) — Details the use of numeric exit codes to communicate the success or failure of functions and scripts. ([source](https://wangdoc.com/bash/function.html))
- [File Pattern Matching](https://awesome-repositories.com/f/development-tools-productivity/file-pattern-matching.md) — Explains the use of wildcards and glob patterns to match and filter files and directories.
- [Shell Positional Parameters](https://awesome-repositories.com/f/development-tools-productivity/positional-argument-handlers/shell-positional-parameters.md) — Covers the use of positional parameters like $1 and $2 to handle dynamic inputs in scripts and functions.
- [Shell Local Variables](https://awesome-repositories.com/f/development-tools-productivity/script-variable-management/shell-local-variables.md) — Provides a comprehensive guide to creating, reading, and deleting variables within shell scripts. ([source](https://wangdoc.com/bash/variable.html))
- [Command Aliasing](https://awesome-repositories.com/f/development-tools-productivity/command-aliasing.md) — Teaches how to assign short aliases to longer commands or commands with default flags. ([source](https://wangdoc.com/bash/script.html))
- [Shell Tab Completions](https://awesome-repositories.com/f/development-tools-productivity/command-completion-systems/interactive-command-completions/shell-tab-completions.md) — Provides tutorials on using tab-completion for commands, paths, and variables within the shell. ([source](https://wangdoc.com/bash/readline.html))
- [Command History Managers](https://awesome-repositories.com/f/development-tools-productivity/command-history-managers.md) — Covers the retrieval, searching, and management of the command execution history. ([source](https://wangdoc.com/bash/history.html))
- [Command-Line Input Optimizations](https://awesome-repositories.com/f/development-tools-productivity/command-line-input-optimizations.md) — Covers keyboard shortcuts and autocompletion techniques to accelerate terminal input. ([source](https://wangdoc.com/bash/grammar.html))
- [Command Line Navigation](https://awesome-repositories.com/f/development-tools-productivity/command-line-navigation.md) — Provides keyboard shortcuts for efficient cursor movement and text navigation within the terminal. ([source](https://wangdoc.com/bash/readline.html))
- [Expansion Behavior Configuration](https://awesome-repositories.com/f/development-tools-productivity/expansion-behavior-configuration.md) — Covers shell settings that adjust hidden file handling and recursive directory matching. ([source](https://wangdoc.com/bash/expansion.html))
- [Prompt Visual Customization](https://awesome-repositories.com/f/development-tools-productivity/interactive-cli-prompts/prompt-visual-customization.md) — Shows how to customize the interactive shell prompt to display user, host, and path information. ([source](https://wangdoc.com/bash/prompt.html))
- [Parameter Shifting](https://awesome-repositories.com/f/development-tools-productivity/positional-argument-handlers/shell-positional-parameters/parameter-shifting.md) — Explains how to use the shift command to iterate through command-line arguments in scripts. ([source](https://wangdoc.com/bash/script.html))
- [Keyboard Shortcuts](https://awesome-repositories.com/f/development-tools-productivity/terminal-input-enhancers/keyboard-shortcuts.md) — Provides instructions for mapping key combinations to shell commands for faster terminal input. ([source](https://wangdoc.com/bash/startup.html))
- [Text Editing Shortcuts](https://awesome-repositories.com/f/development-tools-productivity/text-editing-shortcuts.md) — Provides keyboard shortcuts for deleting characters, swapping words, and performing cut-and-paste operations on the command line. ([source](https://wangdoc.com/bash/readline.html))

### Education & Learning Resources

- [Bash Programming Tutorials](https://awesome-repositories.com/f/education-learning-resources/bash-programming-tutorials.md) — Provides a comprehensive educational guide for mastering Bash scripting and system automation.
- [Bash Scripting Fundamentals](https://awesome-repositories.com/f/education-learning-resources/bash-scripting-fundamentals.md) — Provides educational content on using Bash to automate repetitive system tasks and complex workflows.
- [Linux Command-Line Tool References](https://awesome-repositories.com/f/education-learning-resources/linux-command-line-tool-references.md) — Offers a comprehensive reference for navigating directories, managing files, and executing Linux commands.
- [Unix Administration Guides](https://awesome-repositories.com/f/education-learning-resources/educational-resources/systems-applied-computing/infrastructure-architecture/operating-systems-shell/unix-administration-guides.md) — Provides manuals for managing system processes, file permissions, and environment variables on Unix systems.

### Operating Systems & Systems Programming

- [Shells & Scripting](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/shells-scripting.md) — Offers a comprehensive guide to writing executable shell scripts for system automation and administration. ([source](https://wangdoc.com/bash/))
- [Shell Environment Configurations](https://awesome-repositories.com/f/operating-systems-systems-programming/terminal-command-line-environments/shells-scripting/configuration-scripts/shell-environment-configurations.md) — Details the use of profile scripts to initialize environment variables and aliases. ([source](https://wangdoc.com/bash/startup.html))
- [System Signal Handling](https://awesome-repositories.com/f/operating-systems-systems-programming/system-signal-handling.md) — Provides instructions for trapping and handling operating system signals to ensure clean script shutdowns. ([source](https://wangdoc.com/bash/mktemp.html))

### Programming Languages & Runtimes

- [Bash Programming Logic](https://awesome-repositories.com/f/programming-languages-runtimes/bash-programming-logic.md) — Teaches conditional statements, loops, and functions to create dynamic command-line tools.
- [Boolean Logic Evaluation](https://awesome-repositories.com/f/programming-languages-runtimes/boolean-logic-evaluation.md) — Covers the runtime evaluation of boolean logic and numeric conditions within the shell. ([source](https://wangdoc.com/bash/arithmetic.html))
- [C-Style For Loops](https://awesome-repositories.com/f/programming-languages-runtimes/c-style-for-loops.md) — Teaches the implementation of loops using initialization, condition, and increment expressions. ([source](https://wangdoc.com/bash/loop.html))
- [Command Output Capturing](https://awesome-repositories.com/f/programming-languages-runtimes/command-output-capturing.md) — Provides instructional material on capturing standard output from shell commands into variables. ([source](https://wangdoc.com/bash/expansion.html))
- [Conditional Logic](https://awesome-repositories.com/f/programming-languages-runtimes/conditional-logic.md) — Provides a guide on using boolean expressions and branching structures for flow control. ([source](https://wangdoc.com/bash/condition.html))
- [While Loops](https://awesome-repositories.com/f/programming-languages-runtimes/conditional-logic/while-loops.md) — Explains the use of while-loops to repeat commands as long as a condition remains true. ([source](https://wangdoc.com/bash/loop.html))
- [Execution Flow Control](https://awesome-repositories.com/f/programming-languages-runtimes/execution-flow-control.md) — Covers language constructs that terminate execution when commands fail or variables are unset. ([source](https://wangdoc.com/bash/set.html))
- [Exit Code Flow Control](https://awesome-repositories.com/f/programming-languages-runtimes/exit-code-flow-control.md) — Teaches how to use command exit codes to implement conditional branching and error handling in scripts.
- [Function Argument Passing](https://awesome-repositories.com/f/programming-languages-runtimes/function-argument-passing.md) — Explains the use of positional parameters to pass data and logic into Bash functions. ([source](https://wangdoc.com/bash/function.html))
- [Immediate Script Termination](https://awesome-repositories.com/f/programming-languages-runtimes/immediate-crash-triggering/immediate-script-termination.md) — Guides users on how to stop a script and return an exit status to signal success or failure. ([source](https://wangdoc.com/bash/script.html))
- [Interpreter Specifications](https://awesome-repositories.com/f/programming-languages-runtimes/interpreter-specifications.md) — Provides guidance on using shebang lines to define the required shell interpreter for script execution. ([source](https://wangdoc.com/bash/script.html))
- [Pattern Matching](https://awesome-repositories.com/f/programming-languages-runtimes/pattern-matching.md) — Describes the use of the case structure to match values against multiple patterns. ([source](https://wangdoc.com/bash/condition.html))
- [Shebang-Based Execution](https://awesome-repositories.com/f/programming-languages-runtimes/shebang-based-execution.md) — Instructs on using the shebang line to specify the correct shell interpreter for standalone script execution.
- [String Comparisons](https://awesome-repositories.com/f/programming-languages-runtimes/unicode-and-byte-string-distinction/string-byte-size-calculators/lexicographic-string-comparators/string-comparisons.md) — Details how to evaluate string equality, emptiness, and lexicographical order to control script flow. ([source](https://wangdoc.com/bash/condition.html))
- [Variable Expansions](https://awesome-repositories.com/f/programming-languages-runtimes/variable-assignments/variable-expansions.md) — Covers the replacement of variable identifiers with their assigned values during command evaluation.
- [Shell Command Substitutions](https://awesome-repositories.com/f/programming-languages-runtimes/variable-assignments/variable-substitutions/shell-command-substitutions.md) — Explains how to execute commands and embed their standard output into other commands or variables.
- [Associative Arrays](https://awesome-repositories.com/f/programming-languages-runtimes/associative-arrays.md) — Teaches the implementation of associative arrays to map arbitrary strings to values. ([source](https://wangdoc.com/bash/array.html))
- [Brace Expansions](https://awesome-repositories.com/f/programming-languages-runtimes/brace-expansions.md) — Explains how to expand comma-separated lists or ranges into a series of strings. ([source](https://wangdoc.com/bash/expansion.html))
- [Character Escaping Sequences](https://awesome-repositories.com/f/programming-languages-runtimes/character-escaping-sequences.md) — Details the use of backslash escaping to treat special characters as literal text. ([source](https://wangdoc.com/bash/quotation.html))
- [Arithmetic Assignments](https://awesome-repositories.com/f/programming-languages-runtimes/generic-value-assignments/arithmetic-assignments.md) — Provides examples of using compound assignment operators for shorthand mathematical updates to variables. ([source](https://wangdoc.com/bash/arithmetic.html))
- [Here Documents](https://awesome-repositories.com/f/programming-languages-runtimes/here-documents.md) — Explains the use of here-documents to pass multi-line blocks of text into commands as standard input. ([source](https://wangdoc.com/bash/quotation.html))
- [Here Strings](https://awesome-repositories.com/f/programming-languages-runtimes/here-strings.md) — Demonstrates how to use here-strings to send literal strings to commands expecting standard input. ([source](https://wangdoc.com/bash/quotation.html))
- [Shell Environment Exports](https://awesome-repositories.com/f/programming-languages-runtimes/module-export-specifications/variable-exports/shell-environment-exports.md) — Describes how to export variables so they are available to child processes. ([source](https://wangdoc.com/bash/variable.html))
- [Shell Array Management](https://awesome-repositories.com/f/programming-languages-runtimes/shell-array-management.md) — Provides guides on managing indexed arrays using integer indices and bulk initialization. ([source](https://wangdoc.com/bash/array.html))
- [Shell Command History](https://awesome-repositories.com/f/programming-languages-runtimes/shell-command-history.md) — Guides users on finding and executing previous commands using reverse-search and keyword matching. ([source](https://wangdoc.com/bash/history.html))
- [Shell Option Management](https://awesome-repositories.com/f/programming-languages-runtimes/shell-option-management.md) — Explains how to toggle shell options to control filename expansion and file overwriting. ([source](https://wangdoc.com/bash/set.html))
- [Shell Quoting Strategies](https://awesome-repositories.com/f/programming-languages-runtimes/shell-quoting-strategies.md) — Instructs on using single and double quotes to prevent variable expansion and preserve literal characters. ([source](https://wangdoc.com/bash/quotation.html))
- [String Pattern Replacements](https://awesome-repositories.com/f/programming-languages-runtimes/string-pattern-replacements.md) — Covers string manipulation techniques for searching and replacing text patterns using shell expansion. ([source](https://wangdoc.com/bash/string.html))
- [User Input Capture](https://awesome-repositories.com/f/programming-languages-runtimes/user-input-capture.md) — Details mechanisms for reading text from standard input and assigning it to variables or arrays. ([source](https://wangdoc.com/bash/read.html))
- [Variable Scope Management](https://awesome-repositories.com/f/programming-languages-runtimes/variable-scope-management.md) — Details how to manage variable visibility using local and global scope definitions within functions. ([source](https://wangdoc.com/bash/function.html))

### Data & Databases

- [Numeric Comparisons](https://awesome-repositories.com/f/data-databases/numeric-fields/numeric-comparison-validators/numeric-comparisons.md) — Instructs on performing numerical comparisons to handle logic based on integer equality and ordering. ([source](https://wangdoc.com/bash/condition.html))

### DevOps & Infrastructure

- [Conditional Command Executions](https://awesome-repositories.com/f/devops-infrastructure/conditional-command-executions.md) — Teaches the use of logical operators to trigger subsequent commands based on success or failure. ([source](https://wangdoc.com/bash/condition.html))
- [Batch Command Executions](https://awesome-repositories.com/f/devops-infrastructure/remote-command-execution/batch-command-executions.md) — Details how to execute sequences of shell commands linearly or conditionally. ([source](https://wangdoc.com/bash/grammar.html))

### Software Engineering & Architecture

- [Boolean Logic Combinators](https://awesome-repositories.com/f/software-engineering-architecture/boolean-logic-combinators.md) — Explains how to combine multiple tests using AND, OR, and NOT operators to create complex conditions. ([source](https://wangdoc.com/bash/condition.html))
- [Exit Status Evaluations](https://awesome-repositories.com/f/software-engineering-architecture/failure-handling-policies/success-to-failure-conversion/exit-status-evaluations.md) — Instructional material on evaluating command return codes to trigger error handling. ([source](https://wangdoc.com/bash/script.html))
- [Shell Loop Controls](https://awesome-repositories.com/f/software-engineering-architecture/human-in-the-loop-workflows/loop-iteration-skipping-mechanisms/shell-loop-controls.md) — Explains the use of break and continue statements to control loop iterations. ([source](https://wangdoc.com/bash/loop.html))
- [Shell Function Definitions](https://awesome-repositories.com/f/software-engineering-architecture/remote-function-invocation/scripted-function-definitions/shell-function-definitions.md) — Covers the definition and invocation of named command blocks to create reusable logic in scripts. ([source](https://wangdoc.com/bash/function.html))
- [Integer Arithmetic](https://awesome-repositories.com/f/software-engineering-architecture/integer-arithmetic.md) — Provides a guide to performing fundamental integer arithmetic operations using standard shell operators. ([source](https://wangdoc.com/bash/arithmetic.html))
- [Substring Extraction Methods](https://awesome-repositories.com/f/software-engineering-architecture/string-processing-algorithms/substring-length-metrics/substring-extraction-methods.md) — Provides techniques for extracting specific portions of a string based on offset and length. ([source](https://wangdoc.com/bash/string.html))

### Part of an Awesome List

- [Regex Pattern Matching](https://awesome-repositories.com/f/awesome-lists/devtools/regex-and-pattern-matching/regex-pattern-matching.md) — Provides guidance on using regular expressions to match and verify the format of strings. ([source](https://wangdoc.com/bash/condition.html))

### Scientific & Mathematical Computing

- [Arithmetic Expression Evaluators](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/arithmetic-number-types/arithmetic-operations/arithmetic-expression-evaluators.md) — Explains how BASH evaluates mathematical expressions and utilizes non-zero results for conditional logic. ([source](https://wangdoc.com/bash/condition.html))
- [Assignment Commands](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/arithmetic-number-types/arithmetic-operations/shell-arithmetic/assignment-commands.md) — Teaches the use of specialized commands to calculate mathematical expressions and assign results to variables. ([source](https://wangdoc.com/bash/variable.html))

### Security & Cryptography

- [Octal Permission Assignments](https://awesome-repositories.com/f/security-cryptography/user-access-management/file-and-folder-permissions/permission-copy-controls/octal-permission-assignments.md) — Covers the assignment of read, write, and execute permissions using octal notation for script files. ([source](https://wangdoc.com/bash/script.html))

### Testing & Quality Assurance

- [Shell Debugging](https://awesome-repositories.com/f/testing-quality-assurance/debugging-diagnostics/error-handling/shell-debugging.md) — Provides techniques for debugging Bash scripts using trace modes, exit codes, and syntax checking. ([source](https://wangdoc.com/bash/startup.html))

### Web Development

- [Shell History Retention](https://awesome-repositories.com/f/web-development/history-management/history-retention-policies/shell-history-retention.md) — Guides users on controlling how many commands are stored in the Bash history. ([source](https://wangdoc.com/bash/history.html))
