How To Make A Custom Bash Shell Prompt

Learn how to customize your shell prompt and the specificity of the Bash Prompt variables PROMPT_COMMAND, PROMPT_DIRTRIM, PS0, PS1, PS2, PS3, and PS4.

export PS0=">>updated Sep 20204 examples

The Complete How To Guide of Bash Functions

Learn how to write shell scripts with bash functions. This guide includes examples and best practices on how to define, call, and debug functions in bash.

fn() {updated Sep 202017 examples

What is the Right Way to do Bash Loops?

Looping over a list of numbers or words is a building block in shell scripts. Learn how to write Bash loops, including for loop, while loop, and until loop.

for nameupdated Sep 202014 examples

How To Script Error Free Bash If Statement?

Learn how to script a Bash If statement with the then, else, and else if / elif clauses. Includes Bash conditional expressions and common pitfalls to avoid.

ifupdated Sep 202024 examples

How To Use Option as Meta Key in macOS Terminal?

The Meta Key is a modifier key that can be quite helpful to improve your productivity while working in a terminal and bash. This post cover how to enable from the command line the Meta Key in macOS Terminal.

updated Sep 2020

How to Parse a CSV File in Bash?

Learn how to parse a CSV file in Bash and avoid the common pitfalls. Includes examples using bash builtins and the awk command line.

head -n5updated Sep 20209 examples

A Complete Guide on How To Use Bash Arrays

This guide covers how to use the bash array variables as indexed or associative bash arrays. Includes how to declare, iterate over, sort, and other array operations.

echoupdated Sep 202017 examples

How To Upgrade your Bash Version on Mac OS?

MacOS comes with an outdated version Bash which can be limiting in shell scripts. This post explain how to upgrade your Bash version on Mac from the command line.

bash --versionupdated Sep 20206 examples

How To Do Advanced Math Calculation Using bc?

Learn how to use the GNU Linux bc command line to do math arithmetic and algebra with square root, sine, cosine, tangent, arctangent, bessel, and more.

echo "a=1;updated Sep 20208 examples

How to flush your DNS Cache on Mac OS X?

Learn how to resolve a bad DNS entry returned by your Mac local cache due to a long TTL DNS and how to purge your Mac OS DNS cache for your specific Mac OS version, all this right from the command line.

updated Dec 2021

How to Reload or Change your current Shell?

Learn the basic steps to reload your Linux shell to apply your recent configurations changes. This post cover the POSIX exec builtin command in Bash and the GNOME shell.

help execupdated Sep 20205 examples