Difficulty: Beginner
Estimated Time: 30

Welcome to this Bash basics training guide!

This Introduction to Bash Scripting interactive guide is based on the Open-source Introduction to Bash Scripting eBook.

In this bash crash course, you will learn the Bash basics so you could start writing your own Bash scripts and automate your daily tasks.

Bash is a Unix shell and command language. It is widely available on various operating systems and it is also the default command interpreter on most Linux systems.

Bash stands for Bourne-Again SHell.

As with other shells, you can use bash interactively directly in your terminal, and also you can use Bash like any other programming language to write scripts.

In order to write Bash scripts, you just need a UNIX terminal and a text editor like Sublime Text, VS Code, or terminal-based editor like vim or nano.

Wrap Up

Congratulations! You have just completed the Bash basics guide!

If you found this useful, be sure to star the project on GitHub and download the free eBook!

If you have any suggestions for improvements, make sure to contribute pull requests or open issues.

In this introduction to Bash scripting book, we just covered the basics, but you still have enough under your belt to start wringing some awesome scripts and automating daily tasks!

As a next step try writing your own script and share it with the world! This is the best way to learn any new programming or scripting language!

In case that this book enspired you to write some cool Bash scripts, make sure to tweet about it and tag @bobbyiliev_ so that we could check it out!

Congrats again on completing this guide!

Introduction to Bash Scripting

Step 1 of 12

Bash Structure

Let's start by creating a new file with a .sh extension, as an example we could create a file called devdojo.sh.

To create that file, you can use the touch command:

touch devdojo.sh

Next, make sure that you have the nano text editor installed:

apt install nano

Or you can use your text editor instead.

After that edit the newly created devdojo.sh file:

nano devdojo.sh

In order to execute/run a bash script file with the bash shell interpreter, the first line of a script file must indicate the absolute path to the bash executable:


This is also called a Shebang). All that the shebang does is to instruct the operating system to run the script with the /bin/bash executable.

To save the file with nano press CTRL+O and then press ENTER, to exit press CTRL+X.