Tag: Bash

Browse all articles, tutorials, and guides about Bash

Guides

Posts

Linux
2024-12-18|7 min read

How to Prompt for Yes/No/Cancel Input in Linux Shell Scripts

Learn how to create interactive shell scripts that prompt users for confirmation with Yes/No/Cancel options using various techniques and best practices.

Linux
2024-12-12|7 min read

How to Loop Through File Content in Bash

Learn different methods to iterate through file content line by line in Bash scripts, including handling special characters and processing large files efficiently.

Linux
2024-12-08|5 min read

How to Change Echo Text Colors in Linux Terminal

Learn how to colorize your terminal output using ANSI escape codes with the echo command to make scripts more readable and visually appealing.

Linux
2024-12-03|8 min read

How to Loop Through an Array of Strings in Bash

Learn various methods to iterate through string arrays in Bash, including indexed arrays, associative arrays, and advanced looping techniques with practical examples.

Linux
2024-12-02|7 min read

How to Pipe to and from Clipboard in Bash Scripts

Learn how to integrate clipboard functionality into your Bash scripts using xclip, xsel, pbcopy, and pbpaste for seamless data transfer between terminal and GUI applications.

Linux
2024-11-28|8 min read

Defining Variables with and without Export in Linux Shell

Understand the difference between regular shell variables and exported environment variables, when to use export, and how variable scope affects scripts and processes.

Linux
2024-11-28|6 min read

How to Find Files Using Wildcards in Linux

Learn how to use wildcard patterns with find command to recursively search for files in directories and subdirectories based on name patterns.

Linux
2024-11-22|5 min read

How to Delete Exported Environment Variables in Linux

Learn different methods to remove environment variables from your current shell session and prevent them from persisting in future sessions.

Bash
2024-11-15|8 min read

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.

Bash
2024-11-05|8 min read

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.

Bash
2024-10-22|7 min read

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.

Bash
2024-10-01|7 min read

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.

Linux
2024-09-12|7 min read

How to Fix Echo Newline in Bash When It Prints Literal \n

Learn why echo sometimes prints literal \n instead of newlines and discover multiple solutions to properly output newline characters in Bash scripts.

Linux
2024-09-05|9 min read

How to Parse Command Line Arguments in Bash

Learn various methods to parse command line arguments in Bash scripts, including positional parameters, getopts, and advanced argument handling techniques.

Linux
2024-08-14|8 min read

How to Change the Output Color of Echo in Linux

Learn how to add colors to your echo output in Linux and Bash scripts using ANSI escape codes, tput commands, and color variables for better terminal display.

Linux
2024-07-29|6 min

Redirecting Output to Both a File and stdout in Bash

Learn how to capture command output in a file while still seeing it live in your terminal

Bash
2024-07-08|6 min read

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.

Bash
2024-07-08|7 min read

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.

Bash
2024-06-12|8 min read

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.

Linux
2024-05-20|6 min read

How to Check if a Directory Exists in Bash Shell Scripts

Learn multiple methods to check directory existence in Bash scripts, including proper error handling, permission checks, and practical use cases for reliable automation.

Bash
2024-05-03|6 min read

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.

Bash
2024-05-03|7 min read

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.

Bash
2024-04-18|8 min read

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.

Bash
2024-03-15|7 min read

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.

Bash
2024-03-08|5 min read

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.

Bash
2024-02-15|4 min read

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.

Bash
2024-01-22|6 min read

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.