
The Bash shell is over 30 years old and still going strong. What does it do, where did it come from, and why is it still the most common shell on Linux systems?
What Is a Shell?
When you open a terminal window and type commands, something has to take what you’ve typed, figure out what you intended, and run the tasks you asked for. The software that does this is the shell. A shell is a command interpreter. It scans what you’ve typed and picks out the commands, directory names, file names, and program names so that it can figure out what you’re trying to achieve.
RELATEDWhat is a TTY on Linux? (and How to Use the tty Command)
People often use the phrases “terminal windows,” “command line,” and “shell” interchangeably, but they’re three distinct things. A terminal window is a software representation of a physical teletype terminal. It gives you a connection to the computer. In order to do anything useful, you must be able to type instructions at a command line. The command line is provided by the shell, and the terminal window lets you access the shell.
Shells also allow you to parcel up a collection of commands into a text file called a script. All the commands in the script are executed for you each time you run the script. Scripts deliver efficiency, repeatability, and convenience.
The firstUnix shellwas theThompson shell, called sh
. It was written byKen Thompson, who is possibly the most key member of the original Unix founding fathers atBell Labs. The Thompson shell was used as the default Unix shell up to and including Unix Version 6. It was replaced by theBourne shellin Version 7 of Unix in 1979.
RELATED: What Is Unix, and Why Does It Matter?
The Bourne Shell
The Bourne shell, written byStephen Bourne, was an upgraded replacement for the Thompson shell. It was even started using the same command as the Thompson shell, sh
, to maintain backward compatibility with existing scripts. Backward compatibility was important, but new features were included that provided much functionality that we still use today.
The Bourne shell was an interactive shell and a scripting language. It supported foreground and background task execution and elementary job control. Pipes and redirection were added, along with improvements in handling loops.
The shell now contained some built-in commands, meaning that it didn’t need to pass everything out to external utilities, making it more efficient. The Bourne shell even supported “here documents,” an elegant way to automate sending data into commands.
The Bourne shell raised the bar and became the new standard.
RELATED: How to Use "Here Documents" in Bash on Linux
The Birth of Bash
In 1984, when theGNU projectannounced its intention to make a free Unix clone—written from the ground up and with anew, permissive licensing—the team needed a shell.When a volunteer who had been working on a shell for the GNU project repeatedly failed to deliver anything at all,Brian Foxwas tasked with writing a clone of the Bourne shell.
It was dubbed theBourne Again Shell, or Bash. This was partly in homage to Stephen Bourne and partly wordplay for the sake of it.After its release in 1989,Chet Rameycontributed some bug fixes to Bash. He eventually became a co-maintainer of the Bash shell. Nowadays, he is still the maintainer of the Bash project.
Linus Torvalds, the creator of the Linux kernel, has said that the first two programs that he ran on his new kernel in 1991 were Bash and gcc
,GNU’s compiler. The pairing of the GNU utilities with the Linux kernel was mutually beneficial. The GNU operating system needed a kernel, and the Linux kernel needed everything else that makes up a Unix clone.
Because Bash is the standard GNU shell, it became the standard shell on all GNU/Linux distributions. Linux flourished to the point that it now underpins anastonishing amount of the modern world. The Bash shell surfed that wave of success, too.
Bash incorporates and improves on the feature set of the Bourne shell, but it also took inspiration from other shells, such as theC shell(csh
) and theKornShell(ksh
). For example, the expansion of the tilde “~
” to the value held in the $HOME
environment variable comes from the C shell, and the fc
command that invokes the default editor on commands in the command history comes from the KornShell.
Bash introduced config files such as the “.bashrc” and “.bash_profile” files. Command-line editing on Bash far surpassed the capabilities of previous shells. The manipulation of previously executed commands in the command history was an improved version of the C shells “bang history” feature. Brace expansion was a feature that was missing from the Bourne shell that was implemented in Bash as a superset of the functionality found in the C shell. Arrays were improved by removing their size limits. Parameter expansion in the command prompt allows users to customize their Bash prompt.
The Bash shell aims to be compliant with thePOSIX P1003.2/ISO 9945.2 Shell and Utilitiesstandard.
RELATED: Did Linux Kill Commercial Unix?
Why Bash Is Still Important

Bash couldn’t have lasted this long—over 30 years—as the default Linux shell if it wasn’t up to the job. Because of its long service life and massive user base, Bash is mature and very stable. There are many alternative shells available, from veterans like the C shell and the KornShell to newer shells like theZ shell(zsh) and theFriendly Interactive Shell(fish
). Both the Z shell and the Fish shell have some features that Bash doesn’t as well as arguably better ways to achieve some of the same things that Bash does. So why is Bash still the dominant shell?
Out of all the Linux machines I have ever been called upon to administer, I don’t recall a single one that didn’t have Bash as the shell. Unix machines, yes, but Linux boxes, no. It’s Bash every time. That familiarity lets you get to work quickly and be effective straight away. You already know Bash, so there’s no learning curve. You don’t get hamstrung by tiny differences in syntax that have you going around in circles trying to figure out why something doesn’t work. Time spent figuring out what the incantation should be onthisshell is dead time, so it’s in the interests of the client business to use a well-known and widely used shell.
Using a shell that is—or is trying very hard to be—POSIX compliant matters to many Linux distributions, but what matters more is compatibility with previous releases. Making changes that could break existing scripts is obviously unattractive. Attractive or not, sometimes, you just have to bite the bullet.On Sept.3, 1967, Sweden swapped from driving on the left to driving on the right. At 4:50 a.m., all traffic had to stop, slowly make its way to the other side of the road, and stop once more. At 5:00 a.m., traffic could proceed, with everyone now driving on the right.
Will Bash Ever Be Replaced?
What might seem inconceivable now can actually happen later. Unless we want to cling to the belief that we’ll all use Bash until doomsday, the truth likely is that one day, Bash will be replaced as the default Linux shell—whether it’s still the GNU standard shell or not. Or maybe it will be Bash, but enhanced far beyond the shell that we use today. But whatever takes the place of today’s Bash will either have to be completely (or very nearly) backward compatible or be worth the upheaval, whatever the benefits may be.
This isn’t without precedent.Since version 10.15 of macOS, Apple has dropped Bash and adopted the Z shell as the default shell. Apple has issues with the GNU General Public License (GPL) v.3. Unfortunately, that is the license that Bash uses. The last version of Bash released under GPL v.2 was 2007’s version 3.2.The current version is 5.1. Apple was nearly a decade and a half behind. The only way that Apple could include an up-to-date shell without moving to GPL v.3 was to move to a different shell altogether. To Apple, that was worth the upheaval. (However, you can still switch back to Bash on macOS if you prefer it!)
There’s a world of difference between a power user’s workstation and a line-of-business Linux server that you have to remotely administer over an SSH connection. Out of almost 1.5 million Amazon EC2 hosted servers, over 93% are running Linux. Almost 75% of web servers are running Linux. Organizations like Red Hat, Amazon, and Google use Linux in-house.
It’s hard to imagine what benefits a new shell could offer that would justify that kind of global upheaval. That’s why Bash is cemented in place.
Even Microsoft now offers a way to run a Linux-based Bash shell on Windows 10!
READ NEXT
- › How To Use set and pipefail in Bash Scripts on Linux
- › What Are Bash Dictionaries on Linux, and How Do You Use Them?
- › How to Install Bash on Windows 11
- › How to Manipulate Strings in Bash on Linux
- › Linux Turns 30: How A Hobby Project Conquered the World
- › 8 Typos You Really Need to Avoid on Linux
- › How to Use Double Bracket Conditional Tests in Linux
- › How to Remove Blank Rows in Excel
FAQs
Why bash is used in Linux? ›
Bash Script:
It is used to automate repetitive tasks on Linux filesystem. It might include a set of commands, or a single command, or it might contain the hallmarks of imperative programming like loops, functions, conditional constructs, etc.
Bash is a Unix shell and command language written by Brian Fox for the GNU Project as a free software replacement for the Bourne shell. First released in 1989, it has been used as the default login shell for most Linux distributions. Bash was one of the first programs Linus Torvalds ported to Linux, alongside GCC.
Why is Linux shell important? ›It provides an interface between the user and the kernel and executes programs called commands. For example, if a user enters ls then the shell executes the ls command. The shell can also execute other programs such as applications, scripts, and user programs (e.g., written in c or the shell programming language).
How important is bash? ›Bash scripting is an extremely useful skill for a security professional. In Cybersecurity, you are certain to work in a Linux environment. In those situations, you want to be comfortable using the bash scripting language for navigation, working with tools, and automating repetitive tasks.
What is the difference between bash and shell in Linux? ›Bash is “Bourne Again SHell”, and is an improvement of the sh (original Bourne shell). Shell scripting is scripting in any shell, whereas Bash scripting is scripting specifically for Bash. sh is a shell command-line interpreter of Unix/Unix-like operating systems. sh provides some built-in commands.
What is the difference between bash and Linux? ›bash is one shell. Technically Linux is not a shell but in fact the kernel, but many different shells can run on top of it (bash, tcsh, pdksh, etc.). bash just happens to be the most common one.
What is shell in Linux in simple words? ›Shell is a UNIX term for the interactive user interface with an operating system. The shell is the layer of programming that understands and executes the commands a user enters. In some systems, the shell is called a command interpreter.
What is the main purpose of shell? ›A shell is a program whose primary purpose is to read commands and run other programs. This lesson uses Bash, the default shell in many implementations of Unix. Programs can be run in Bash by entering commands at the command-line prompt.
Which shell is best for Linux? ›- The Bourne Shell. As mentioned before, the Bourne Shell is the first – and original shell – written by Steve Bourne. ...
- The C Shell. ...
- Korn Shell. ...
- GNU Bourne-Again Shell. ...
- Tenex Shell. ...
- Fish (Friendly Interactive Shell) ...
- Zsh (Z-shell)
The terminal is the GUI window that you see on the screen. It takes commands and shows output. The shell is the software that interprets and executes the various commands that we type in the terminal. Bash is a particular shell.
What can we do with Bash? ›
A bash script is a series of commands written in a file. These are read and executed by the bash program. The program executes line by line. For example, you can navigate to a certain path, create a folder and spawn a process inside it using the command line.
What does Bash stand for? ›Bash is the shell, or command language interpreter, for the GNU operating system. The name is an acronym for the ' Bourne-Again SHell ', a pun on Stephen Bourne, the author of the direct ancestor of the current Unix shell sh , which appeared in the Seventh Edition Bell Labs Research version of Unix.
What are some advantages of Bash shell scripting? ›- Writing a shell script is faster and quicker.
- Quick start.
- Interactive debugging is available.
It is named a shell because it is the outermost layer around the operating system.
Should I learn Bash or shell? ›You should learn to use Bash before anything else. Python is great and useful, but if you don't know your way around the shell, you'll be completely lost trying to understand any Unix-like OS.
Is Bash the same as SSH? ›To recap, SSH is a piece of software that provides a secure remote connection between you and a shell, or some other network resource. Bash is a shell program, and provides text-based login and command line capabilities to its users.
Do you need Linux for bash? ›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.
What is the relationship between bash and Linux? ›Nowadays, Bash is the default user shell of most of the Linux distributions. The Linux/Unix shell allows us to interact with the Linux system through the commands. It let us invoke an executable file to create a running process. Moreover, it also allows us to interact with the Linux file system.
Does Linux run bash? ›Modern Linux distros, however, use bash as the default shell. It's a standard de-facto. While running, scripts execute built-in commands and programs located in different places or directories such as /bin, /usr/bin, etc.
What are the 3 shells that are used by Linux? ›- The Bourne Shell (sh) Developed at AT&T Bell Labs by Steve Bourne, the Bourne shell is regarded as the first UNIX shell ever. ...
- The GNU Bourne-Again Shell (bash) ...
- The C Shell (csh) ...
- The Korn Shell (ksh) ...
- The Z Shell (zsh)
What are the two types of shells in Linux? ›
- Bourne shell − If you are using a Bourne-type shell, the $ character is the default prompt.
- C shell − If you are using a C-type shell, the % character is the default prompt.
8 Types of Linux Shells.
What is the most important shell? ›Bash, or the Bourne-Again Shell, is by far the most widely used choice and it comes installed as the default shell in the most popular Linux distributions.
What is difference between kernel and shell? ›A kernel is the very core of a typical OS. A shell is a CLI (command-line interpreter). A kernel is a type of low-level program that has its interfacing with the hardware on top of which all the applications run (disks, RAM, CPU, etc.). A shell allows all of its users to establish communication with the kernel.
What is the default shell of Linux? ›Bash is the default shell on almost all the Linux distributions but there are some other popular shells available such as: ksh. zsh. fish.
Which shell is fastest? ›According to my tests, ksh is the winner and zsh is the runner-up. Both shells are 2–30 times faster than bash depending on the test.
Which shell is most common and best to use? ›Which shell is the most common and best to use? Explanation: Bash is near POSIX-compliant and probably the best shell to use. It is the most common shell used in UNIX systems. Bash is an acronym which stands for –“Bourne Again SHell”.
What is the difference between SSH and shell? ›SSH is used to interact with a particular VM that I create whereas, cloud shell is used to just interact with the gcp services. Like a console to interact with gcp service.
What is Linux terminal called? ›The Linux command line is a text interface to your computer. Often referred to as the shell, terminal, console, prompt or various other names, it can give the appearance of being complex and confusing to use.
Is Linux terminal same as shell? ›A shell is a user interface for access to an operating system's services. Most often the user interacts with the shell using a command-line interface (CLI). The terminal is a program that opens a graphical window and lets you interact with the shell.
How does bash shell work? ›
Bash reads input from the terminal when interactive, and from the script file specified as an argument otherwise. When interactive, bash allows the user to edit command lines as they are typed in, using familiar key sequences and editing commands similar to the Unix emacs and vi editors.
What happens when you run bash? ›Bash is a program that reads command and executes them. It can read them from a file, or you can type them from an interactive prompt. When you run a terminal, it's simply a window that runs bash in interactive mode, possibly reading some initialization code first.
Is bash difficult to learn? ›Overall, Bash is relatively easy to learn. Most students can learn basic, intermediate, and advanced commands within six months.
How to use Bash shell in Linux? ›Using bash on the command line (Linux, OS X)
You can start using bash on most Linux and OS X operating systems by opening up a terminal. Let's consider a simple hello world example. Open up your terminal, and write the following line (everything after the $ sign): zach@marigold:~$ echo "Hello world!" Hello world!
Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file.
What is bash vs SSH? ›To recap, SSH is a piece of software that provides a secure remote connection between you and a shell, or some other network resource. Bash is a shell program, and provides text-based login and command line capabilities to its users.
What does bash stand for? ›The name Bash is an acronym for Bourne-Again SHell, a pun on the name Stephen Bourne, creator of one of Bash's predecessors. The first beta was released in 1989, and, as of this writing, has seen its most recent update in December 2020: version 5.1.
What can you do with bash? ›Bash scripts can be used for various purposes, such as executing a shell command, running multiple commands together, customizing administrative tasks, performing task automation etc. So knowledge of bash programming basics is important for every Linux user.
What is PuTTY in Linux? ›PuTTY (/ˈpʌti/) is a free and open-source terminal emulator, serial console and network file transfer application. It supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket connection. It can also connect to a serial port.
Is bash still useful? ›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.
Is bash a compiler or interpreter? ›
Bash is a single-pass interpreter which means it reads one command at a time, interprets, and runs it then and there. The same thing is true with other types of shells - sh, ksh, zsh, csh, etc.
What's the difference between Bash and terminal? ›The terminal is the GUI window that you see on the screen. It takes commands and shows output. The shell is the software that interprets and executes the various commands that we type in the terminal. Bash is a particular shell.