Bash is used by default in every Linux distribution I have tried, over alternatives like Z shell (zsh). Is there a technical or historical reason for this?

  • 1
    It's not. On my FreeBSD system tcsh is the default shell!
    – Petros
    Oct 27 '09 at 4:44
  • 54
    Your FreeBSD system isn't a Linux distro.
    – Jurily
    Oct 27 '09 at 4:51
  • 8
    God forbid there's some consistency between distros...
    – OMG Ponies
    Oct 27 '09 at 4:52
  • 4
    No, but it belongs to "everywhere" :)
    – Petros
    Oct 27 '09 at 4:54

History (acquired not through research but through spending entirely too much time hanging out with Bell Labs people):

  1. In the beginning (if you consider the beginning to be Unix Version 7) was the Bourne shell. Steve Bourne was the first to show that the shell which controlled the user's interaction could be a user program and not a special part of the operating system. A historic breakthrough. The shell itself was relatively clean for scripting, but had no command-line editing or job control. Bourne's Introduction to the Unix Shell is still useful for beginning users today.

    Edit: I've ignored some "prehistory" from Ken Thompson and John Mashey, also from Multics. I'm sure Bourne was aware of all this work (he was in the same lab, 1127, at Bell Labs), but Bourne's shell was definitive, and the earlier work had little influence except as interpreted by Steve Bourne. For example, although Ken later wrote the Plan 9 C compiler and was very influential on Plan 9, but Tom Duff's paper on the Plan 9 shell (rc) mentions only Bourne's shell, not Thompson's.

  2. The shell is just a user program, so anybody can write one. As Version 7 Unix was being created in New Jersey, Berkeley Unix was being created in California. Bill Joy at Berkeley wrote csh, the C shell. Joy added job control and history, and later command-line editing, but was not aware of Bourne's work and so based his language on the Thompson shell (which I considered "prehistoric" in the previous bullet). The Unix community loved job control, but they also loved Bourne's language. For a not-particularly-good polemic against the csh language, see Csh Programming Considered Harmful. For a time, many people used csh interactively for its job-control and history features, but used Bourne's sh to write scripts. This situation was less than ideal.

    Edit: Thanks to DigitalRoss for straightening me out on the chronology of csh. Since I got my education from people who refer to BSD as "the Berkeley heresy", I was pretty short of facts there.

  3. Dave Korn at Bell Labs did a brilliant re-engineering of the Bourne shell to produce the Korn shell (ksh). It was fully backward compatible with Bourne shell sh but provided a boatload of invaluable improvements. ksh became the basis of a POSIX standard and was shipped standard with Sun software. (This despite the fact that Bill Joy left Berkeley to help found Sun and was one of their leading software guys.)

  4. Bell Labs and AT&T stupidly fail to make ksh open source. ksh88 is widely used, but having sources is not legal. Certain people become so addicted that they become digital criminals.

    Edit: Was this really so stupid? Hard to know. Berkeley was already giving Unix away, and other corporations were soon to follow, but this was still the era when the Corporate Masters believed in charging for Unix. But the results: AT&T Unix is dead, after having been sold off to various parties any number of times. BSD and its derivatives are alive and well, but these upstart things called "Linux" and "GNU" have a huge fraction of mindshare that once belonged to Bell Labs.

  5. The Free Software Foundation does a "clean-room", from scratch implementation of a POSIX shell, taking all of Dave Korn's ideas as then current, plus in usual FSF style adding new features of their own, such as programmable completion. They call it the "Bourne again" shell, or bash.

  6. In the middle 1990s AT&T open-sources ksh93, but by then it is too late for widespread adoption. The licensing agreement is weirdly nonstandard. bash and ksh diverge, and ksh never achieves market share commensurate with its place in history.


  • The first adequate product to market wins (sh).

  • People love new features (job control, command completion), but they love them even more when their old scripts continue to work.

  • Edit: Professors of engineering should leave history to historians of science :-)

  • I think you really have the most complete and accurate explanation for the popularity of bash over everything else. I've seen environments that default to zsh and I hate them because all the syntax is just a little off and I can't figure it out or I make mistakes.
    – Omnifarious
    Oct 27 '09 at 5:40
  • 2
    Without blaming Norman specifically, there are many inaccuracies here. Ken Thompson wrote the first shell, which was the only shell through V6 and was in use in parallel in V7 and 32V. Stephen Bourne was not the "first" shell writer, he rewrote the KT shell. Csh did not have job control until 4.1BSD, though it was the first shell to get it. Csh did not change any shell syntax, it was backward compatible with the V6 shell, as was the Bourne shell. Almost all code was licensed in those days. What exactly was stupid about charging license fees for Unix? Oct 27 '09 at 21:53
  • 3
    I'm probably not explaining this very well, let me try again. Csh predates Bourne, or at the latest was a parallel implementation a continent away. (Before the internet, that mattered.) I was sitting next to Bill Joy in Cory Hall, occasionally, when he wrote it; I can absolutely assure you he wrote it on V6. As I said, csh (and Bourne) are V6-Thompson-backward-compatible, as that is all that existed when they wrote them. Of course it's not Bourne-compatible, AFAIK Bill Joy's talents did not include seeing the future Oct 28 '09 at 2:19
  • 2
    Didn't bash take the idea of programmable completion from tcsh?
    – user193100
    Jun 29 '13 at 19:16
  • 1
    @EvanTeitelman, yes, bash programmable completion appeared years after zsh's which itself appeared years tcsh. zsh caught up with tcsh in the mid 1990s, bash caught up with tcsh in the mid-2000 but is still a decade behind zsh
    – sch
    Jan 24 '14 at 20:24

Bash has two completely different things going for it.

  1. It's a fine shell. It is one of maybe 2 shells (the other is zsh) that integrate some of the cool csh features like ! history substitution into the posix syntax. It has lots of extensions, including arrays.

  2. It is the FSF/GNU shell. In the open source world, this gives it a sort of cachet.

I should also add that it is not always the default. ash is often used as /bin/sh so that while bash may be the interactive shell, ash is the "just run the command file" shell. This is because ash is smaller and faster, and contains the posix features, so it's a proper subset. Using ash as an interactive shell is sometimes problematic. On, say, NetBSD, it works well, because there it is built with all the features. It's kind of their one shell whereas bash is an external package. But on Linux ash is usually considered non-interactive, so they compile it without the history and without the (important) line editing on the theory that it is just used to run those huge gnu configure scripts.

Tale of Two Shells

The real history of the shell

UPDATE: There is an inaccurate history of the shell being copied from place-to-place on the web, and people are understandably believing it. I will try to give an accurate version and provide a few links to substantiate it here.

  1. The first shell was most certainly not the Bourne shell but was written by Ken Thompson himself and distributed in V6, which is the version AT&T sent to various universities and government labs. This is what put Unix on the map. It had all the basics, <, >, >>, |, &, but it just had simple goto control syntax via an external program that seeked on standard input. There were no complex shell scripts then. Later shells would open the command input on a separate fd. It may look simple today but in the horror-movie that was 1970's computing it was the best thing on earth. Believe it or not, this ancient shell has its own twitter stream today and, of course, a home page.
  2. The second shell was csh, written (as was vi) by Bill Joy at UCB. This was before GNU readline and NetBSD editline, so it must have seemed perfectly reasonable to do history with the ! syntax. Csh added most of today's shell features but with csh syntax. csh did not change any syntax, gratuitously or otherwise. It was actually backwards compatible to the Thompson shell, and originally included TS source code.
  3. The third shell was the Bourne shell, with different syntax. Unix was being developed in parallel at UCB and AT&T. This shell had a weird memory allocator (I think it just used more memory, trapped SIGSEGV, did a new brk(2), and then tried again) that made it hard to run on new Unix ports, so osh and csh stayed popular for some time. There was no internet and it was licensed SW, so in that environment it's possible that Stephen Bourne didn't know about Joy's shell and certainly Joy didn't know about Bourne. It's possible that the two shells first met when UCB got a VAX and a prerelease of the now-forgotten Unix/32V. I remember Bill complaining about the memory allocation. Note that both shells were backward-compatible to the V6 shell, they simply extended the syntax in different directions.
  4. Now there really were multiple incompatible shells, to which AT&T added the Bourne-compatible ksh. Eventually, csh had semi-available source code, but it was tied up in a lawsuit between AT&T and the University of California. Still, these were the glory days of BSD Unix as sophisticated companies who could afford the $50,000 fee would buy the AT&T license but install the 4.x BSD distributions, and universities got it for free.
  5. In this situation with many legal and technical issues, various independent implementations were undertaken. At least as many went with the csh syntax as went with the Bourne shell syntax, and some merged the two. You had at least tcsh, zsh, bash, and ash. The Bourne syntax was "official", being part of AT&T releases, but in those days BSD was quite important, and Sun, initially BSD, distributed a fair amount of the Unix SW that the world encountered.
  6. Partly because of the USL lawsuit, the FSF and Linux had an open field. Meanwhile, AT&T had managed to pick a fight with one of the few entities on earth larger than they were (The State of California) and in the end they didn't win the suit, and so eventually the BSD distribution was on a firm legal footing. But by then Linux and bash were everywhere, and so today BSD is a niche.
  7. Finally, bash is a good shell (though apparently disowned privately by its original author) and it fully deserves the credit for its own success. csh would have been eclipsed by tcsh and zsh even if ash, bash, and ksh had not won the syntax war.
  • Also, /bin/sh needs to be statically linked.
    – delete
    Oct 27 '09 at 4:33
  • If anything in /bin and /sbin depends on /usr, that's broken and needs to be fixed; they should only depend on libraries in /lib. Only login needs PAM; the "newer API" which requires dynamic libs would be NSS. "Trend to"? NetBSD 2.0 already switched to a fully-dynamic /bin and /sbin 5 years ago, FreeBSD 5.2 even longer ago, and Linux... well, that varies by distro, but that's been a long time too.
    – ephemient
    Oct 27 '09 at 18:53
  • 2
    I want to make it very clear that my answer is my original work; no words have been copied from anywhere. Oct 27 '09 at 23:12
  • 1
    Sure, I didn't mean you pasted it, just that there is a lot of misinformation around and I didn't want to bash you for reporting an already misunderstood story. Oct 28 '09 at 2:20

To add to what @DigitalRoss said

  • Bash is a complete superset replacement for posix-sh, even to the point if called as /bin/sh will emulate posix-sh entirely. Posix-sh was the "standard" for commercial unix systems as a common-denominator shell. So, something that starts there and builds on it is starting with a lot.

Because Linux is just the Kernel (and required support stuff) while GNU provides (or did provide) all the basic Unix software clones that make what we call "Linux" usable. Bash is the GNU project's shell written as a clone of the older Bourne shell (sh) from Unix Version 7.

  • he's not asking "why is there a shell program"
    – hasen
    Oct 27 '09 at 5:56
  • @hasen j: The question is asked if there is a historical reason why all the Linux systems he has used default to Bash as the shell.
    – beggs
    Oct 27 '09 at 6:38
  • 2
    @hasen j: beggs is not answering "why is there a shell program". You've missed the point of the answer, as have all the other SO knee-jerk downvoters obviously.
    – Troubadour
    Oct 27 '09 at 7:45

According to a unix.com survey, it's not that much farther ahead of ksh.
/bin/sh 83 8.96%
/bin/csh 36 3.89%
/bin/ksh 370 39.96%
/bin/tcsh 36 3.89%
/bin/bash 401 43.30%


Bash is widely accepted due to its rich set of features. It also adopts features from other shells like C-shell and Korn-shell. Please take a look at these set of features.


Because 'bash' is 100% 'sh/ksh' compatable and 'ksh' is the POSIX shell.

So if you want a POSIX compliant system, and you are on Linux then you use bash.

If you are on a commercial unix you generally get ksh as the default shell (sometime plain just old sh). For some reason Sun still defaults to the flakey csh c-shell.

The advantage is portability a .sh written for hp-ux or AIX has a good chance of running as a linux 'bash' without any changes.

  • ksh is not the POSIX shell. There is no such thing as the POSIX shell. There are shells that conform to the POSIX specification, which ksh is one of, but by no means the only one.
    – Idelic
    Oct 27 '09 at 15:47

And to add to all other answers: zsh is not meant to be backwards compatible. You probably can set it up so that it will be compatible, but then you're losing its features.

I do use zsh as my regular interactive shell, but bash/dash seem more sane to me as a shell scripting languages; they do less magic and are more predictable... this is more important for me when I'm writing a script that is meant to work for several years.


Just to confuse matters, the sh command is sometimes just a symbolic link to another shell program, such as ash, bash or dash.

Ubuntu used to link it to bash, since bash is designed to run any compliant Bourne shell script.

Recently, though, Ubuntu switched to having sh link to dash. dash is designed to run bash scripts (and thus also sh scripts), but it is designed to be used only for scripting, so it lacks the interactive features of bash. That makes it smaller and (perhaps) faster.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.