Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Most recent Linux distributions include bash as default shell, although there are other, (arguably) better shells available.

I'm trying to understand if this is some historical leftover that nobody wants to change, or are there some good reasons that make bash the first choice?

share|improve this question
15  
Most computers are being sold with MS Windows installed, although there are other, arguably better OS's available. –  choroba Jan 10 '12 at 10:44
    
Bash is simple. It can usually do everything that user wants it to do. You can easy switch it. That will be not fun to have scsh by default. –  Heather Jan 10 '12 at 11:37
4  
Bash is OSS implementation of UNIX standard /bin/sh, which is default shell on 'normal' UNIX-es... –  Jan Marek Jan 10 '12 at 11:47
    
I know this a wiki link but it answers your question in depth, What one shell has than the other en.wikipedia.org/wiki/Unix_shell –  whoami Jan 10 '12 at 12:20
5  
Please define (arguably) better. I think bash is the best shell because i know it well and it's everywhere, does everything i need concisely and relatively easily, is easily readable, and can be somewhat understood by people without knowing how to create bash scripts. What else do you want from a shell? If you want lots of programming features, you're using a shell incorrectly. –  nicerobot Jan 10 '12 at 13:24
show 1 more comment

6 Answers

up vote 9 down vote accepted

The short answer is because linux is really GNU/Linux. Only the kernel is linux but the base collection of utilities providing the Unix like environment is provided by GNU and the GNU shell is bash
As I said, that's the short answer ;)

edited to add some additional commentary...
Let me prefix by saying that I'm not a Unix historian, so I can only answer IMHO

A few points, first of all bash is the kitchen sink of shells, as emacs is to editors.
At the time bash was released there were no free ksh implementations, tcsh was a free csh replacement, but Stallman had a rant against csh for shell programming.
As an interactive shell bash had excellent history/command recall, along with the saving of history from session to session. It was a drop in replacement for sh, bsh, ksh for shell programming and made for a decent interactive shell.
Like a snowball rolling downhill, bash has gained momentum and size.

Yes, there are dozens of other shells; shells that are better suited for individual purpose or taste, but for a single all around shell bash does a decent job and has had a lot of eyes on it for over 20 years.

share|improve this answer
    
I understand. However, most distributions include many other non-GNU software. It seems to me that bash is used just because it is used, just like choroba commented from Windows being a dominant OS. However, for decades Windows had better hardware support (drivers) which made it hard to switch to other OS. I fail to see what unique feature Bash offers to prevent users from switching? –  Milan Babuškov Jan 10 '12 at 19:21
    
+1 and good one @bdowning for the short and simple answer :-) –  Nikhil Mulley Jan 11 '12 at 8:19
    
thanks @bdowning for your answer +1 from me –  Abhishek Jan 12 '12 at 4:38
add comment

Bash has some potential competitors:

  • Zsh has more advanced interactive facilities, but a few quirks when it comes to scripting (less so now than back in the days). In the early to mid-1990s when Linux was in its infancy, zsh was virtually unknown.
  • Ksh was the de facto standard on commercial unices since the mid-1980s, but it was proprietary software until 2000, so not an option on Linux. Also, ksh had subpar command line edition capabilities, compared with bash.
  • Pdksh, a free clone of ksh, would have been an option, but it was not well-known and had poor command line edition capabilities. (Pdksh is no longer a very active project, even though it's still used in some BSDs, now that ATT ksh is free.)
  • Some distributions install an ash variant as /bin/sh. Ash (by which I mean any of the loose family of shells called ash) is designed to be small and fast, with no interactive features (it's only for editing scripts). The ash revival is relatively recent; in the 1990s the existing variants lacked a lot of features.
  • Tcsh was the most advanced interactive shell until zsh came along, but it's incompatible with sh and not so good with scripting.

Furthermore bash is the official GNU shell, and Linux systems are really GNU/Linux: many of the core programs come from GNU, even if the best-known part, the Linux kernel, doesn't. At the time it became the de facto standard, bash was well-known, had an official status, and had a decent set of features.

share|improve this answer
    
As I understand, the POSIX standard specifies required features for the Bourne shell, at /bin/sh, and most Linux distributions depend upon shell scripts written to use the Bourne shell. BASH is at base an enhanced version of the Bourne shell, and /bin/sh is actually a link to /bin/bash, that when executed runs with just the Bourne shell features. –  bgvaughan Jan 12 '12 at 18:18
    
@bgvaughan Some distributions ship bash as /bin/sh, others ship ash. For example Ubuntu's /bin/sh has been dash (the fork of ash maintained by Debian) for a while. Bash has more features, ash is smaller and faster. Both are POSIX compliant (or at least compliant enough in practice). –  Gilles Jan 12 '12 at 18:54
add comment

Coming from DOS (with doskey installed) I really missed the feature to recall the last commands by simply moving the cursor up/down. BASH was IMO the first shell that implemented this on *nix.

So probably most guys from that generation onward liked bash.

share|improve this answer
add comment

Simplest answer? Because something "has to be" the default. The most sensible default is the one that most users are already comfortable with. On that point Bash is a good choice. Everybody has the freedom to choose which is best, in their world. Most will choose to use the default if it has always done what they need.

share|improve this answer
add comment

All the other answers are great, but from a practical standpoint: If I sit down in front of an unfamiliar system (or access it remotely) and I need to do something, I can count on bash being available on all but the oldest systems. I can just go ahead and get things done.

As pointed out in other answers and in your question, there are a lot of other shells (I hear a lot of good things about zsh, but haven't tried it.), but they vary with respect to syntax and sometimes the commands used to get things done. If I just want to get something done, bash is tricky enough without having to adapt to another shell.

Also, when I write a shell script that might be generally useful, I write it for bash and I know that if I'm very careful not to do system dependent things, it will run almost anywhere.

share|improve this answer
add comment

Inertia.

Bash happened to be the most easily available free shell when Linux (GNU/Linux, if you prefer) systems started appearing. The fact that it's from the GNU project didn't hurt.

As for why it's still the default shell, there's never been a good enough reason to change it. Even if some other shell is better, there are advantages to having the same default login shell across different distributions, and it would be difficult to get everyone (Debian, Red Hat, Suse, etc.) to agree to switch to something else.

And after all, it's only a default. Any user can use chsh to change his or her login shell. There's no need to change the default for everyone.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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