Default shell?

Greg Fitzgerald


Reaction score: 5
Messages: 58

What is everyone using as there default shell. I currently use zsh, but I wonder if anyone is just using /bin/sh or if tcsh is good enough for daily usage? Just looking for others opinions on the matter.

Looks like /bin/sh is Bourne Shell? Hows this differ from Bash?

Alain De Vos


Reaction score: 642
Messages: 2,158

I use zsh as root shell an user shell.
And mksh as toor shell, installed in /bin, in case something would be broken and allowing me to recover.
I don't think changing to bash is an improvement, or I would not know for what.


Son of Beastie

Reaction score: 2,342
Messages: 3,236

Bourne shell is a predecessor of bash. Bash is the old Bourne shell having gone through the GNU treatment, adding lots of functionality.

I use bash consistently on all machines, even FreeBSD. Why? Because for shell scripts, the old bourne shell is much better than (t)csh. And I want the language in which I write shells scripts to be the same that I use at the command line everyday, so I am and stay familiar with the syntax (old joke, beware of the man who has only one gun, because he knows how to use it). For shell scripts, I usually go back to using /bin/sh (which is a subset of bash), and trying to use only features that were in V7 standard sh, but interactively, I enjoy the modern features of bash too much (even though I don't them in scripts). Ideally, I could use ksh or zsh or any of the myriad other extensions of the Bourne shell (all of the best ones seem to be derived form the Korn shell these days), but bash is trivially present on all machines I use at work, without having to do any installs there, and at work I use lots of computers, so installing something there would be a BIG hassle.

So, is it a good idea to use bash on FreeBSD? Probably not, because it is non-base optional software. For me, the benefits outweigh the negatives. Other people may not want to follow my example.

And then I go even one step further, and do something that I explicitly recommend people NOT do: I change the default shell of root on my FreeBSD machines to also be bash! I always create a toor account that has tcsh, for emergencies. I know that this will bite me one of these days, but I know how to get out of that pickle if I need to.

I think your choice of zsh is perfectly sensible, but that's really a personal choice. Just make sure you have an account like toor that uses a shell that ships in the base system, in case everything comes apart at the seams.


Staff member

Reaction score: 12,286
Messages: 38,799

Why tcsh over sh? Is tcsh more powerful in some way?
For interactive use the sh(1) shell is, ehrm, kind of spartan. tcsh(1) on the other hand has all the nice features you want with a interactive shell, like command history. Nowadays sh(1) has some command history too, but it's fairly rudimentary and, for lack of a better description, spartan.

But, try a couple of shells, some people like bash, I personally don't. Others are quite fond of zsh, old UNIX-beards often use a Korn shell (or a variant thereof). I just like to stick to whatever is in the base and have gotten used it.


Aspiring Daemon

Reaction score: 310
Messages: 754

For everything interactive I have been using tcsh(1) for ages and don't expect that to change anytime soon. For scripting I prefer to use sh(1) though.



Reaction score: 701
Messages: 1,229

Isn't it also what you started out with? For me it was csh then tcsh and I've never bothered to change. For non-interactive, it's sh because I'm not a huge fan of nuances of tcsh like ${?variable} and its pedantry with spaces, eg $a==$b. Bzzt!

I can operate interactively in sh but only a short while before I grow frustrated with no pushd/popd


Staff member

Reaction score: 12,286
Messages: 38,799

For non-interactive, it's sh because I'm not a huge fan of nuances of tcsh like ${?variable} and its pedanty with spaces, eg $a==$b. Bzzt!
For scripting purposes the C shells are an absolute horror show. Mostly because of the weird redirections but there are a lot of other quirks too. Really old document but still holds true to this day: Csh Programming Considered Harmful


Son of Beastie

Reaction score: 2,097
Messages: 3,790

I'm using the Korn shell (shells/pdksh) for my own account because I enjoy the enhanced interactive options in comparison to the regular /bin/sh (I'm always using vi mode). Root remains to the default csh because I prefer having something blocking me from using shell commands I'm familiar with without thinking. So if I try to use a "for a in *txt[/file] I'd get an error because csh requires foreach.

All other users on the server (not many) get /bin/sh, also because they can always change their own shell if they want to. However, no Bash on this setup.


Son of Beastie

Reaction score: 1,509
Messages: 2,630

What is everyone using as there default shell. I currently use zsh, but I wonder if anyone is just using /bin/sh or if tcsh is good enough for daily usage?
My default shell is zsh as well, as it's probably the most capable bourne shell out there. I might be an alien in the FreeBSD community, but I don't want to touch a C shell -- doesn't make sense to me to use a different syntax/grammar in interactive use than in scripts.

On some virtual machines where I only have to to a few administrative tasks now and then, I don't bother installing zsh and just use /bin/sh.


Active Member

Reaction score: 121
Messages: 231

Root and script : sh.
User : zsh
In all my computer.

And when I have a mission with bash script, I transform it to sh.

Using bash to deploy something to a server is not a good idea. Ubuntu default shell (dsh ?) do not reconize «source».
But where is the world «source» is easiest to use than «.»(dot) ? :)


Aspiring Daemon

Reaction score: 231
Messages: 677

I never change the root shell... but for me bash,in my servers and mi desktops



Reaction score: 20
Messages: 28

For scripts: POSIX shell. (/bin/sh seems compliant.)
For interactive use: Bash, because why not? It's a Bourne-like shell with support for history and auto-completion.
For root: I just leave it with /bin/tcsh.

I did use Korn shell (ksh88 mostly) for many years while I was programming on HP-UX and Solaris, but for a long time it was a hassle to install it on FreeBSD, and Bash seemed fine.



Reaction score: 676
Messages: 1,357

I got used to bash when I did use Linux, and then it stayed.
But for scripting I strictly use /bin/sh, mainly because they should work without ports installed or /usr/local mounted. I don't bother with the shell's scripting features (regexps, arrays, etc.) and use sed and awk for the more difficult operations. I would like to use more ruby there, but it's the same downside: it is in ports.



Reaction score: 3
Messages: 21

(T)CSH as interactive shell for four reasons
  • It is in base
  • Its interactive features have always been better than Bash's
  • It is the login shell I'm using since early '90s 😄
As for scripting, honestly I can't think of any reason to use anything other than the sh shell the system uses for its own scripts.


Aspiring Daemon

Reaction score: 239
Messages: 552

Most people are just going to prefer the shell with which they get most familiar. For interactive use, you are going to want one with good history editing.

If CPU cycles matter (they rarely do for interactive use), then bash is an utter pig. It's pretty heavy on memory too. Also, its interactive history editing is frequently criticised as clumbsy (because it is).

When you are in single user mode, in full emergency response, you don't want to be struggling with an unfamiliar shell, particularly since the man pages won't be available.

For those reasons I keep a statically linked copy of my favourite shell in the root (and use it as the root shell). For historical reasons, that happens to be ksh. It might just as easily been zsh.

I generally script in /bin/sh, but stick to the V7 Bourne shell syntax for portability (dash compatibility matters to me because I use Debian nearly as much as I use FreeBSD).

If I think my shell script needs arrays, hashes, or anything not available in the original Bourne shell, I switch to perl (because it's portable and I'm comfortable with it). Others may choose python.

However I have been known to script in bash, very occasionally. It generally happens when I get part way through a shell script, realise it's more complex than originally thought, and I'm just too lazy to switch to perl.