Bash sounds like a strange name for a command-line interface that greets users logging into any Linux distribution. What exactly is Bash? What can you use it for? Let’s find out.

While Bash is usually associated with Linux, you can use it on Windows as well. macOS already includes Bash, though it has changed the default shell to Zsh – an advanced version of Bash with some additional features.

Table of Contents
    What Is the Bash Shell in Linux? image 1

    What Is a Shell?

    The term Bash shell gets thrown around a lot, but what’s a shell anyway? Why is it needed? And why does Bash seem to be the only shell out there?

    Modern operating systems with their intuitive graphical user interfaces have made using a computer seem easy. But in the early days of computers, telling a system what to do was not that straightforward.

    What Is the Bash Shell in Linux? image 2

    Programmers had to know the low-level details of the system they were coding for, and manually instruct every piece of hardware. Operating Systems were designed to bridge this gap, but how would you instruct the OS itself?

    Enter the Shell. The outermost layer of the OS was designed to be an interactive environment exposing all the functionality of the computer in a simple interface. This shell was the furthest a user of the computer had to delve into, as it contained all the commands required to operate the system.

    Bourne Again: How Bash Came to Be

    A common misconception is that Bash was created by Linus Torvalds for the Linux operating system. In reality, Bash was merely ported into Linux, already being used in its predecessor, Unix.

    In many ways, Unix is where it all began for modern operating systems. It stripped away much of the convoluted complexity that plagued early OS implementations, presenting the functions of a computer in a comparatively simple text-based interface.

    Of course, Unix itself borrowed most of its ideas from Multics, including the concept of a shell. But it was Unix that actually popularized the technique, with the Thompson Shell being rolled out with its first version.

    What Is the Bash Shell in Linux? image 3

    Its functionality was quite limited, however, and many programmers ended up modifying the shell to make it more scripting friendly. The Bourne Shell was the official replacement of the Unix shell, adding support for shell scripts.

    The Bourne Again Shell was released much later, offering a further improvement in its scripting capabilities and turning it into a free, open-source GNU license shell that could be used by any OS. And it was quickly adopted by Linux, becoming the default shell for its various distros.

    But What Can Bash Do?

    Bash is basically a fully-fledged scripting environment with complete access to the Linux system. From managing files to running applications, you can carry out every computing task with Bash commands.

    For most Linux users, this only translates to manual shell commands. After all, the main purpose of Bash is to serve as an interface to the operating system.

    What Is the Bash Shell in Linux? image 4

    And there are quite a few of these built-in commands. You can manage file ownership with chown, configure network settings with ifconfig, locate directories with find – the list goes on.

    But Bash wouldn’t exist if Linux commands were all that users were interested in. No, the true power of the Linux shell lies in scripting.

    The Importance of Scripting

    The idea of scripting commands is simple. Instead of manually entering all the commands you want the system to carry out one by one, you save the commands in a text file that can be run on demand.

    This turns the shell interface into a programming language of sorts, allowing users to automate any action into a reusable script. Obviously, it goes further than that, as any programming language needs things like variables and functions in addition to the ability to save code.

    And Bash has all those features. This is why the shell – and to some extent, Linux in general – is so popular for managing servers and commercial systems.

    A home user may get by clicking through a bunch of buttons, but a system administrator needs to be able to perform any action on a large number of computers remotely. Bash scripts are what make this kind of automated system management possible.

    For example, consider our guide on renaming files and folders on Linux. The guide illustrates both methods – GUI and script. As you can see, the scripting method is far more scalable when there are a large number of files involved.

    Getting Started With Bash

    The good thing about Bash is that it isn’t limited to Linux alone. You can now install Linux on Windows through the Windows Subsystem for Linux (WSL), which comes with Bash by default.

    What Is the Bash Shell in Linux? image 5

    That means you can start experimenting with Bash without having to switch completely to Linux. Even if you are a casual user who does not intend to work with Linux servers, the interesting capabilities of a Bash shell can be useful for you.

    Not that Bash is your only option for automating computing tasks. PowerShell is a similar interface that works with Windows – apart from what you can manage with the Command Prompt, of course.