Bash-tutorials Articles
How to Append to File in Bash
Append text and data to files in Bash using redirection operators. Add single/multiple lines and conditional appending.
Bash Arrays - Indexed and Associative Arrays Complete Guide
Master Bash arrays. Learn indexed arrays, associative arrays (dictionaries), array operations, iteration, and best practices.
How to Filter with Awk
Conditional filtering in awk in Bash with practical examples. Learn if/else and field-based filtering.
How to Process Fields with Awk
Field processing in awk in Bash with practical examples. Learn field access, manipulation, and custom delimiters.
How to Break Out of Loop in Bash
Exit loops prematurely in Bash using break statement. Works with for, while, and until loops.
How to Calculate Average in Bash
Calculate average and sum of numbers in Bash using awk, bc, and loops.
How to Capture Groups in Bash
Extract matched pattern groups in Bash with practical examples using parentheses and BASH_REMATCH array.
How to Use Case Statement in Bash
Switch-like pattern matching in Bash. Case statements for cleaner conditional logic, wildcard patterns, and script menus.
How to Change File Permissions
Use chmod to modify file permissions in Bash with symbolic and numeric modes. Learn to set executability, readability, and ownership.
How to Check if String Contains Substring in Bash
Check if a Bash string contains a substring using parameter expansion, grep, and conditional operators. Case-sensitive and case-insensitive methods.
How to Check if Command Exists
Test if command is available in Bash. Check for command existence with command -v, type, and other methods.
How to Find Common Lines Between Files
Find matching lines in two files in Bash using comm, grep, awk, and comparison techniques.
How to Compare Dates in Bash
Compare two dates and determine which is earlier or later in Bash. Learn string comparison, epoch time, and file dates.
How to Compare Numbers in Bash
Numeric comparisons with operators in Bash using -eq, -lt, -gt and other comparison operators.
How to Compare Strings in Bash
Compare strings in Bash using different operators and methods. Lexicographic comparison, equality testing, and pattern matching.
Bash Complete Guide - Learn Shell Scripting from Scratch
Master Bash scripting with this comprehensive guide. Learn variables, loops, functions, text processing, and real-world automation examples. Perfect for beginners.
How to Concatenate Strings in Bash
Join and concatenate strings in Bash. Multiple methods including variable expansion, printf, and array joining.
How to Skip Loop Iteration in Bash
Skip to the next iteration in Bash loops using continue statement. Works with all loop types.
Bash Control Structures - If, Loops, and Case Statements
Master Bash control structures: if/else statements, for loops, while loops, until loops, and case statements with practical examples.
How to Copy Files in Bash
Copy files in Bash using cp command. Copy single files, multiple files, with options, and preserve file attributes.
How to Copy Multiple Files
Copy several files at once in Bash with practical examples.
How to Count Occurrences in Bash
Count pattern matches in files and strings using grep, awk, sed, and bash built-ins.
How to Count Unique Lines in Bash
Count occurrences of unique lines in files using uniq, sort, and awk with practical examples.
How to Iterate with Counter in Bash
Loop with an index or counter variable for controlled iteration.
How to Create Directory in Bash
Create directories in Bash using mkdir command. Create single directories, nested directories, and with specific permissions.
How to Schedule Script with Cron
Schedule Bash scripts to run periodically using cron. Learn cron syntax, crontab management, and scheduling examples.
How to Get Current Date in Bash
Get current date in Bash using date command. Display various date formats and customize output.
How to Get Current Time in Bash
Get current time in Bash with various formats and timezones using date command.
How to Calculate Date Difference
Find days or hours between two dates in Bash. Calculate date differences in various units with practical examples.
How to Get Day of Week
Determine day name from date string in Bash using date command with format specifiers. Learn weekday checking and scheduling.
How to Delete Files Matching a Pattern in Bash
Delete multiple files matching a pattern in Bash using wildcards, find command, and regex patterns with practical examples.
How to Check if Directory Exists in Bash
Test if a directory exists in Bash using the -d test operator. Create directory if it doesn't exist and other practical patterns.
How to Find Duplicate Files
Identify duplicate file copies in Bash with practical examples.
How to Check if String is Empty in Bash
Test if a Bash string is empty or null. Multiple methods using test operators and conditional expressions.
How to Exit Script with Error Code in Bash
Proper error handling and exit codes in Bash. Use exit codes for error reporting, script chaining, and automation.
How to Extract Column from CSV in Bash
Extract specific columns from CSV files in Bash using cut, awk, and parameter expansion. Learn column selection, filtering, and transformations.
How to Extract Numbers from String
Extract numeric values from text strings in Bash using grep, sed, awk, and regex patterns.
How to Extract Substring in Bash
Learn how to extract substrings from Bash strings using parameter expansion. Extract from position, get last N characters, and extract ranges.
How to Check if File Exists in Bash
Test if a file exists in Bash using test operators. Check for regular files, directories, readability, writeability, and more.
Bash File Operations - Create, Read, Delete, Copy, Move, Permissions
Master file operations in Bash. Create, read, delete, copy, move files, and manage permissions with practical examples.
How to Filter Lines by Pattern in Bash
Select and extract lines matching specific patterns from files using grep, awk, sed, and bash built-ins.
How to Find Files in Bash
Search for files in Bash using find command. Find by name, type, size, modification date, and permissions with practical examples.
How to Find Maximum Value in Bash
Find largest number in dataset or column in Bash using sort, awk, loops, and built-in comparison functions.
How to Find Minimum Value in Bash
Find smallest number in dataset or column in Bash using sort, awk, loops, and comparisons.
How to Get First Character of String
Extract first character from string in Bash with practical examples.
How to Format Numbers with Commas
Add thousands separator to numbers for readability in Bash using printf, numfmt, sed, and awk.
Bash Functions - Syntax, Parameters, Return Values, and Best Practices
Master Bash functions: declare, parameters, return values, scope, local variables, and reusable code patterns.
How to Generate CSV from Data
Create CSV files from command output, arrays, and data sources in Bash. Learn formatting and special character handling.
How to Get File Owner
Determine file ownership in Bash using stat, ls, and test operators. Get owner and group information for files and directories.
How to Get File Permissions
Check file permission bits in Bash using stat, ls, and file test operators. Learn numeric and symbolic permission formats.
How to Get Last Character of String
Extract last character from string in Bash with practical examples.
How to List Files by Date
Sort files by modification date in Bash with practical examples.
How to Loop Through Array in Bash
Iterate through Bash arrays using for loops, while loops, and array expansion with practical examples.
How to Loop Through Files in Directory in Bash
Iterate over files in a Bash directory using for loops, globbing, and find command with practical examples. Process file batches efficiently.
How to Convert String to Lowercase in Bash
Convert strings to lowercase in Bash using parameter expansion, tr command, and awk. Works with Bash 4+ and older versions.
How to Merge Lines in Bash
Combine multiple lines into one in Bash with practical examples.
How to Test Multiple Conditions
Combine conditions with && and || operators in Bash. Learn logical AND, OR, and complex condition patterns.
How to Parse CSV Files in Bash
Parse CSV files in Bash using while loop, IFS, and read command. Extract fields and process CSV data with multiple methods. ETL and data processing.
How to Read File Line by Line in Bash
Read files line by line in Bash using while loop, IFS, and read command. Multiple methods with practical examples.
How to Read File into Variable
Store entire file or parts of file in Bash variables using different reading methods and practical examples.
How to Match Regex in Bash
Use regular expression matching in Bash with the =~ operator. Learn pattern matching, capture groups, and practical examples.
Bash Regular Expressions - Pattern Matching and Validation
Master Bash regular expressions. Learn pattern matching syntax, validation techniques, and practical examples for data processing.
How to Remove Directory in Bash
Delete directories in Bash using rmdir and rm -r commands. Remove empty directories and entire directory trees safely.
How to Remove Duplicate Lines in Bash
Remove duplicate lines from files in Bash using uniq, sort, and awk commands. Learn deduplication techniques.
How to Remove Special Characters
Strip non-alphanumeric from string in Bash with practical examples.
How to Rename File Extensions
Batch rename file extensions in Bash with practical examples.
How to Replace Text in a String in Bash
Learn 3 methods to replace text in Bash strings: parameter expansion, sed command, and tr utility. Includes examples for single and multiple replacements.
How to Reverse a String
Reverse string order in Bash in Bash with practical examples.
How to Round Decimal Numbers
Round floating point numbers to N decimal places in Bash using printf, bc, awk, and other tools.
Bash Scripting Fundamentals - Writing and Executing Scripts
Learn how to write, structure, and execute Bash scripts. Master shebangs, permissions, debugging, and best practices for production-ready scripts.
How to Delete with Sed
Remove lines using sed in Bash with practical examples. Delete by line number, pattern, or range.
How to Use Sed to Replace
Stream editor substitution examples in Bash. Learn basic substitution, advanced patterns, and file editing with sed.
How to Sort Lines in Bash
Sort file contents and command output in Bash using sort command with various options and techniques.
How to Split String by Delimiter in Bash
Split strings by delimiter in Bash using read command, IFS, parameter expansion, and awk. Multiple methods for different scenarios.
How to Count Characters in a String in Bash
Get the length of a Bash string using parameter expansion. Learn multiple methods and handle Unicode strings correctly.
Bash String Manipulation - Complete Reference Guide
Master string manipulation in Bash. Learn substring extraction, replacement, case conversion, trimming, and parameter expansion techniques.
How to Check String Matches Pattern
Use regex matching in conditionals with =~ operator. Learn pattern testing and conditional logic in Bash.
How to Check if String Starts With
Test string prefix in Bash with practical examples.
How to Sum Column in Bash
Add up values in a column from CSV or structured data files using awk, bc, paste, and bash loops.
How to Create Temporary File
Create and manage temp files safely in Bash using mktemp with cleanup traps and best practices.
Bash Text Processing - Reading, Filtering, and Transforming Files
Master text processing in Bash. Read files, filter lines, transform data, and use grep, sed, and awk effectively.
How to Convert Timestamp to Date
Convert Unix time to readable date and vice versa in Bash. Learn timestamp conversion techniques and formatting.
How to Trim Whitespace from String in Bash
Remove leading and trailing whitespace from Bash strings. Multiple methods using parameter expansion, sed, and xargs.
How to Convert String to Uppercase in Bash
Convert strings to uppercase in Bash using parameter expansion, tr command, and awk. Examples for Bash 4+ and compatible methods.
How to Validate Email in Bash
Regex pattern for email validation in Bash with practical examples.
How to Validate IP Address
Regex pattern for IP validation in Bash with practical examples. Learn IPv4 and IPv6 validation techniques.
How to Validate Phone Number
Regex pattern for phone validation in Bash with practical examples. Validate US, international, and custom formats.
How to Validate URL in Bash
Regex pattern for URL validation in Bash with practical examples. Validate HTTP/HTTPS URLs and common formats.
How to Check if Value Exists in Array
Find element in array efficiently in Bash using loops, conditional expressions, and helper functions.
Bash Variables & Data Types - Complete Reference Guide
Master Bash variables, data types, scoping, and special variables. Learn parameter expansion, variable validation, and best practices.