# KodeKloud: Beta Courses Advanced Bash Scripting

## Advanced Bash Scripting

### Introduction

- [Course Introduction](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Introduction/Course-Introduction/page.md): Learn advanced techniques and best practices to enhance your Bash scripting skills through interactive labs and hands-on exercises.
- [Why learn advanced bash scripting](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Introduction/Why-learn-advanced-bash-scripting/page.md): Learning advanced Bash scripting enhances automation, troubleshooting, and productivity, making it essential for DevOps and systems engineers in production environments.
- [Interactive vs non interactive shell](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Introduction/Interactive-vs-non-interactive-shell/page.md): The article explains the differences between interactive and non-interactive shells in Bash scripting.
- [Shell scripting vs Bash scripting](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Introduction/Shell-scripting-vs-Bash-scripting/page.md): This article compares shell scripting and Bash scripting, highlighting their differences, features, and when to use each.
- [Terminology](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Introduction/Terminology/page.md): This article clarifies the terms shell, CLI, terminal, console, TTY, and POSIX compliance for Unix-like environments.

### Conventions

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Conventions/Overview/page.md): This guide covers shell scripting conventions to enhance readability, maintainability, and collaboration through consistent coding styles.
- [Variables](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Conventions/Variables/page.md): Proper variable management in Bash scripts enhances readability, prevents overwrites, and simplifies code maintenance through best practices for naming, constants, and exporting values.
- [Functions](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Conventions/Functions/page.md): Functions are essential for writing clean, modular shell scripts, covering best practices for naming, defining, and styling functions in Bash.
- [Expanding](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Conventions/Expanding/page.md): This article explains variable expansion in shell scripting, including usage of braces, quoting, and best practices for handling variables.

### Refresher

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Overview/page.md): This guide revisits essential shell scripting fundamentals and demonstrates how to weave them into reliable, maintainable scripts.
- [Scriptflow](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Scriptflow/page.md): Mastering shell script execution flow using control constructs like conditionals, loops, sourcing files, and functions for reliable Bash scripting.
- [Functions](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Functions/page.md): This article explains how to use Bash functions for structuring, reusing, and maintaining scripts, enhancing modularity and readability in coding.
- [Command Line Arguments](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Command-Line-Arguments/page.md): This guide covers command-line arguments in shell scripting, from basic parameters to advanced techniques for creating flexible scripts.
- [pid](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/pid/page.md): Explains process IDs in shell scripting including parent and child processes, TTYs, background jobs, builtins versus external commands, inspecting processes, signals and detaching with nohup
- [Built in Commands](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Built-in-Commands/page.md): This article discusses optimizing Bash script performance by using built-in commands to reduce latency and resource consumption.
- [Keywords builtins](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Keywords-builtins/page.md): This article explores the differences between Bash built-in commands and shell keywords, focusing on execution, process forking, and their roles in scripting.
- [Guard clause](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Guard-clause/page.md): Explains using guard clauses in shell scripts to fail fast, reduce nesting, and improve readability and maintainability of scripts
- [Shebang](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Refresher/Shebang/page.md): This article explores the shebang directive, its impact on script execution, and best practices for portability across different shells.

### Streams

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Overview/page.md): This lesson covers Linux streams, their manipulation in shell scripting, and techniques for redirecting and chaining commands.
- [File descriptors](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/File-descriptors/page.md): This guide explains file descriptors in Unix and Linux, including their definition, usage, and standard streams.
- [devnull](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/devnull/page.md): Redirecting standard error to standard output in Bash to capture or suppress command output effectively.
- [Input](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Input/page.md): Explains shell input and I/O file descriptors stdin stdout stderr, pipes and redirection, detecting interactive input, tracing syscalls, and using custom file descriptors for in place edits.
- [Heredocs](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Heredocs/page.md): Heredocs allow embedding multi-line text in Bash scripts, simplifying command execution and reducing errors compared to multiple echo statements.
- [Pipes](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Pipes/page.md): This guide covers named and anonymous pipes in Bash for directing command output and enabling efficient workflows.
- [Pipefail](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Pipefail/page.md): This guide explains how to handle pipeline errors in Bash using `set -o pipefail` for robust scripting.
- [Exit code](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Exit-code/page.md): This article explains exit codes in Bash scripts, their significance, and how to implement custom exit codes for error handling.
- [Xargs](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/Xargs/page.md): This article explains how to use `xargs` to build dynamic command lines from standard input for more flexible shell scripting.
- [printf](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Streams/printf/page.md): This article explains the `printf` command in Unix-like systems, highlighting its formatting capabilities and differences from `echo`.

### Expansions - Part One

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-One/Overview/page.md): This guide explores core shell expansions in POSIX-compliant shells to enhance shell scripts and command-line workflows.
- [Variables](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-One/Variables/page.md): This article explains variable expansion in Bash, covering access, manipulation, and advanced features for effective scripting.
- [Parameter Part One](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-One/Parameter-Part-One/page.md): This article explains Bash parameter expansion for transforming variable values, focusing on removing prefixes and suffixes from strings.
- [Parameter Part Two](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-One/Parameter-Part-Two/page.md): Explores advanced parameter expansion techniques using wildcards for flexible string manipulation in Linux, focusing on file paths and extensions.

### Globs

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Overview/page.md): This article explains Bash globbing patterns for matching file and directory names using concise syntax, contrasting them with regular expressions.
- [Globs Question Mark](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Globs-Question-Mark/page.md): This article explains the use of the `?` wildcard in glob patterns for precise file selection in Bash and other shells.
- [Star](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Star/page.md): This article explains the use of the asterisk wildcard in shell globbing for matching file names and improving command-line efficiency.
- [Escape](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Escape/page.md): This article explains shell globbing, escape characters, and how to manage filename patterns using wildcards and literals.
- [Mixed](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Mixed/page.md): This article teaches advanced techniques for using glob patterns in Bash to match complex filename patterns efficiently.
- [Square](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Globs/Square/page.md): This article explains square bracket globbing in Bash for matching filenames using character classes and ranges.

### Expansions - Part Two

- [Brace](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-Two/Brace/page.md): This article explains brace expansion in Bash, a feature for generating strings or arguments using curly braces.
- [Command Substitution](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-Two/Command-Substitution/page.md): This article explains command substitution in Bash scripting, detailing its syntax, usage, and considerations for performance and subshell scope.
- [Subshells](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Expansions-Part-Two/Subshells/page.md): This article explains subshells in Bash, covering command substitution, syntax, common scenarios, and how to manage variable scope and process IDs.

### Special Shell Variables

- [Overview](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Overview/page.md): This article explains special shell variables in Bash for better script feedback and error handling.
- [Special shell Question mark](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Special-shell-Question-mark/page.md): The article explains the special shell variable `$?` which holds the exit status of the last executed command for error handling in shell scripts.
- [Hashtag](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Hashtag/page.md): This guide explains how to use `$#` in Bash to count command-line arguments for better error handling and input validation in scripts.
- [ifs](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/ifs/page.md): The article explains the Internal Field Separator (IFS) in Bash, its default behavior, customization, and implications for string manipulation in shell scripting.
- [Args](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Args/page.md): This guide explains handling command-line arguments in Bash scripts using positional parameters, special variables, and quoting techniques.
- [pid](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/pid/page.md): This article explains the use of special shell variables `$$` and `$!` for managing process IDs in Bash and POSIX-compatible shells.
- [Zero](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Zero/page.md): This article explains the use of the `$0` special shell variable in Bash scripting for script name retrieval and directory resolution.
- [Underscore](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Underscore/page.md): The special shell variable `$_` holds the last argument of the previous command, enhancing productivity in Bash sessions and scripts.
- [Dash](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Special-Shell-Variables/Dash/page.md): This article explains the `$-` special shell variable in Bash, detailing its flags and differences between interactive and non-interactive modes.

### Arrays

- [Declare](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Declare/page.md): This article explains the `declare` command in Bash for assigning variable attributes and data types, including arrays and type enforcement.
- [Arrays](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Arrays/page.md): This article explains how to declare, access, and effectively use arrays in Bash scripting.
- [Insert](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Insert/page.md): Learn to manage Bash arrays by adding, replacing, and inserting elements for more powerful and flexible scripts.
- [Remove](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Remove/page.md): Learn to manage Bash arrays by removing specific elements and clearing all elements in one command.
- [Sort](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Sort/page.md): Learn to append elements to a Bash array and sort it using Unix utilities.
- [Associative](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Associative/page.md): This tutorial explores associative arrays in Bash, covering declaration, access, modification, and iteration in scripts.
- [Arrays demo](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Arrays/Arrays-demo/page.md): This tutorial explains how to create a Bash script that randomly selects a lunch spot from a list without repeats.

### Good Practices applied

- [Strict Mode](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Good-Practices-applied/Strict-Mode/page.md): This article explains how to enable Strict Mode in Bash for writing more robust and error-resistant shell scripts.
- [no op Commands](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Good-Practices-applied/no-op-Commands/page.md): Learn to perform dry runs in Bash scripts using the no-op command to test logic without modifying files or data.
- [Comments](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Good-Practices-applied/Comments/page.md): Clear, concise comments make your shell scripts easier to maintain, understand, and extend while following best practices for documentation.
- [Logging](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/Good-Practices-applied/Logging/page.md): Track events with ISO 8601 timestamps by wrapping date calls in functions for consistent, machine-friendly logs across environments.

### awk

- [Introduction to awk](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Introduction-to-awk/page.md): Awk is a powerful language for text processing, enabling easy filtering, transforming, and formatting of structured text.
- [awk print](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/awk-print/page.md): This guide covers awk's syntax, pattern-action structure, and the print statement for data extraction and formatting.
- [Built in Variables](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Built-in-Variables/page.md): This guide explains how to use awk's built-in variables for efficient text data parsing and manipulation.
- [Option F](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Option-F/page.md): Learn to use the -F option in awk to customize field separators for processing structured text.
- [Option v](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Option-v/page.md): Explains using awk -v to set variables before execution with examples, best practices, and filtering demos using a sample employees dataset
- [Option Files](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Option-Files/page.md): Explains running awk programs from files, contrasting pure awk scripts and Bash hybrid approaches, covering shebangs, quoting, variable passing, field separators, and portability considerations.
- [Bash Hybrid](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/awk/Bash-Hybrid/page.md): This guide demonstrates combining awk with Bash for processing text files and building a reusable salary-benchmarking tool.

### sed

- [Introduction](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/sed/Introduction/page.md): Introduction to GNU sed for stream editing text from the command line, covering substitutions, line edits, flags, in-place editing, differences with BSD sed, and practical one-liners.
- [sed print](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/sed/sed-print/page.md): This guide teaches how to use seds print script to selectively display lines and control output in command-line workflows.
- [Delete](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/sed/Delete/page.md): This guide explores how to delete lines from input files using the `sed` command, covering various deletion methods and in-place updates.
- [Find](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/sed/Find/page.md): Learn to use `sed` for searching, printing, and deleting text patterns in files efficiently.
- [Substitute](https://notes.kodekloud.com/docs/Advanced-Bash-Scripting/sed/Substitute/page.md): The `s` command in `sed` enables powerful search-and-replace operations on text streams for various tasks like updating files and automating processes.
