If you’ve ever opened up the terminal on your Mac, then you may have wondered what to do next. What exactly are you supposed to type in when you see that retro-looking cursor?

While most of us control our computers with a mouse, the keyboard can also be heavily utilized to interact with it. Developers on macOS and Linux machines use Bash every day to work with files and applications and save time or make the most of limited computing resources.

In this article, we’ll go over what Bash is, what it’s used for, and how to get started with Bash.

What is Bash?

Bash is a command-line interface shell program used extensively in Linux and macOS. The name Bash is an acronym for “Bourne Again Shell,” developed in 1989 as a successor to the Bourne Shell.

“What’s a shell?” you ask? A shell is a computer program that allows you to directly control a computer’s operating system (OS) with a graphical user interface (GUI) or command-line interface (CLI).

Learn something new for free

You actually use GUI shells all the time. For example, Windows 10 is based on the Windows shell that allows you to control your OS with a desktop, taskbar, and menus.

With a CLI shell like Bash, you type commands into the program to directly control your computer’s OS. Opening up the terminal on your Mac or command line in Linux will look similar to consoles and integrated development environments (IDEs) for other programming languages such as R, Ruby, or Python. You can type commands directly in the command line or run Bash scripts to perform longer and more complex tasks.

Advantages of Bash

One of the biggest advances in computer software development was the introduction of windows and menus, so what’s the point of going back? People use CLIs like Bash because they still have a few distinct advantages over GUIs. Let’s explore some of these advantages.

Access your operating system more efficiently

People use Bash when they want to control their computer or OS without having to navigate menus, options, and windows within a GUI. As we pointed out earlier, with CLIs like Bash, you usually don’t even need to use your mouse. You can navigate through your computer’s OS without your fingers ever leaving your keyboard.

For example, if you want to quickly create, edit, or delete multiple files, it’s easier to use Bash instead of finding each file by pointing and clicking on multiple directories.

Plus, using Bash instead of a GUI is less resource-intensive since your computer doesn’t need to dedicate resources to rendering graphical output. This makes Bash an attractive option when you’re already running multiple programs, a virtual machine, or otherwise have limited computing resources to work with.

Input and output with text files

Bash makes it easy to create and edit text files, including CSVs. And, since text files are one of the most common ways to store and process data, Bash is great for performing tasks like:

  • Preparing and curating data.
  • Sorting and filtering through data.
  • Cleaning and updating data.

Data Scientists love Bash because it helps them pre-process large datasets quickly and efficiently. And, even if you don’t need to work with big data, Bash is helpful in many other contexts. For example, two common tasks that people perform on their computers are:

  • Looking up files within a folder.
  • Searching for files that contain certain text.

When you do these tasks with the GUI, there’s no way to easily record your results. But with Bash, you can copy and paste your results or write them to a text file to use as input in another programming language.

Automate with ease

Bash also makes automating tasks on your computer much easier. This is especially useful when part of your job involves repetitive functions.

Suppose that you’re a cybersecurity expert at a company, and part of your job is to make sure that new hires’ laptops are configured correctly. You could use the GUI to navigate through menus and windows with points and clicks, then adjust settings as needed.

Or, you could write a single Bash script that does the same thing on any new computer. No more pointing and clicking, and no more worrying about whether you remembered to do everything on your checklist.

Run any programming language from the same application

Whether you’re a Data Scientist or a Back-End Developer, you probably have several programming languages installed along with multiple IDE applications. Bash is a way to centralize how you run scripts in different languages so that they can effectively communicate with each other. For example, you can use Bash to:

  1. Run a database query using SQL
  2. Use the results to run an analysis in R
  3. Use those results as input for a Python script.

As long as the programming language is installed on your computer, you can access it with Bash.

Can you use Bash in Windows?

While Bash is famous for being the go-to CLI shell in Mac and Linux, Windows uses Command Prompt and PowerShell to perform the same functions as Bash. But, it’s now possible to install Bash on Windows 10 to provide almost the same functionality as Bash in Mac and Linux.

Most importantly, programmers who use Bash in Windows can run the same commands and utilities to query, create, edit, run, and delete files and directories.

How do you learn Bash?

Bash is a programming language as much as it is an application, which means that Bash comes with its own syntax. And, while you can look up how to use individual Bash commands as you need them, most developers find it much easier to learn all the basics at once with an introductory online course on Command Line.

To get a better understanding of the syntax, here’s a peek at what a Bash script looks like:


echo "Counting from 1 to 5 using a for loop:"

# Simple for loop to iterate from 1 to 5
for i in {1..5}
    echo "Number: $i"

echo "Finished counting."

The biggest advantage to learning Bash is that it’s so widely used. Even if you’re working in another programming language like Python or Ruby, it’s worth learning Bash because many languages support Bash commands to pass data and information to and from your computer’s OS.

Bash makes life easier for developers

Whether you’re pulling together data files as a Data Analyst or configuring servers as a Back-End Developer, learning Bash will make your job easier and faster. In fact, you’ll find that developers who know Bash have a head start when it comes to finding a job to start their development career.

What other skills should you have as a new developer? Check out our career paths, which have helped developers-in-training put together the right skill set to get you noticed by hiring managers.

Related courses

3 courses

Related articles

7 articles

What Is DOS?

By Michael Klein

Not sure what DOS is and why people use it? We’ll teach you everything you need to know about what DOS is, how it works, and why people use it.


Getting Comfortable in the Terminal: Linux

By Codecademy Team

When you hear the word “command line”, “terminal,” or “little window that tells a computer what to do but only has a flashing cursor in it,” what comes to mind? Do you scream and hide under your bed? Or do you look at me inquisitively and wonder why I would bring such a scary thing up?