Bash
Browse all articles, tutorials, and guides about Bash
About Bash
Explore Bash scripting to automate everyday tasks. Learn command-line techniques, shell utilities, and tips for building robust scripts.
Posts
How to Check if a Variable is Set in Bash
Learn multiple methods to check if variables are set, unset, empty, or have specific values in Bash scripts with practical examples and best practices.
How to Check if a String Contains a Substring in Bash
Learn multiple methods to check for substring presence in Bash, including pattern matching, case-insensitive searches, and practical examples for string validation.
How to Concatenate String Variables in Bash
Learn multiple ways to combine string variables in Bash scripts, from simple concatenation to complex string operations with practical examples.
How to Set a Variable to the Output of a Command in Bash
Learn multiple methods to capture command output in Bash variables using command substitution, including best practices and error handling techniques.
How to Check if a File Does Not Exist in Bash
Learn various methods to test for file non-existence in Bash scripts, including proper error handling, permission checks, and practical automation examples.
How to Extract Filename and Extension in Bash
Learn multiple methods to extract filenames, extensions, and directory paths from file paths in Bash using parameter expansion and basename commands.
How to Split a String on a Delimiter in Bash
Learn multiple methods to split strings using delimiters in Bash, including IFS, parameter expansion, and array techniques with practical examples.
How to Redirect and Append Both stdout and stderr to a File in Bash
Learn different methods to capture both standard output and error streams in Bash, including appending to files and separating streams for better logging.
How to Check if a Program Exists from a Bash Script
Learn multiple reliable methods to check if a command or program is available on your system from within Bash scripts, including using which, command, and type.
What Does "2>&1" Mean in Linux and Bash?
Learn what the 2>&1 redirection operator means in Linux commands, how it works with standard output and error streams, and when to use it effectively.
How to Count Lines of Code in a Directory Recursively
Discover multiple methods to count source code lines across entire directory trees, including filtering by file types and excluding specific directories.
How to Get the Directory Where a Bash Script is Located
Learn multiple reliable methods to determine the directory path of your Bash script from within the script itself, including handling symbolic links and edge cases.
How to Iterate Over a Range of Numbers in Bash Using Variables
Learn different methods to loop through number ranges defined by variables in Bash, from simple for loops to advanced sequence generation techniques.
How to Reload .bashrc Settings Without Logging Out
Need to apply changes to your .bashrc file immediately? Learn multiple methods to reload your Bash configuration without restarting your terminal session.
Looping Through File Content Line by Line in Bash
Learn multiple techniques to read and process file content line by line in Bash scripts, including handling special characters and preserving whitespace.