Which Shell Do You Prefer?
Pascal de Bruijn asks: "I recently started to use NetBSD, the first thing I noticed was that it didn't have a command-line history. So I immediately wanted to switch my shell, being on BSD my first instinct was to change to tcsh, but many people told me it wasn't any good. Others recommended zsh. I would really like to hear your opinions about shells." The submitter is particularly interested in shell memory usage, and the features you like...and dislike...from the current options that are available, today.
Korn Shell
did you try enabling it, it's off by default
set history=1000
- or maybe -
history = 1000
- or possibly -
set history 1000
I've never seen a shell without command line history, but I've logged into a lot of places where it wasn't turned on by default.
Chris Kuivenhoven is a thief, beware
Bash baby!
nuff said
Blarf.
It? Command-line history isn't a feature of an operating system, it's a feature of a shell.
Read csh programming considered harmful. It's not really sensible to write shell scripts using one shell and use another, so steer clear of csh.
Many people like zsh for it's completion routines, but I believe bash has similar facilities by now.
it's sexy
Conch shells.
If your plane crashes on a deserted island, and you get the conch shell, you 0\/\/n3rs the island.
Opinions on the Twiddler2 hand-held keyboard?
I like bash. It's common, fairly standard. It has history and tab completion. That's all I really need or use. I have it in linux/solaris/cygwin so I'm rarely forced to use something else. Never really cared or needed to use something else.
The GeekNights podcast is going strong. Listen!
Personally, I prefer Emacs, because VI doesn't have enough features.
Actually, wait, I prefer Gnome, because I dislike KDE's philosophy in duplicating technologoies that already exist, but in the "KDE" style...
Enterprise vs. the Battlestar Galactica? Enterprise, baby! Battlestars always catch on fire, as if they were made of rice-paper.
No wait, wait... this is about shells. Gosh, I've never used a shell. What is it?
"Can of worms? The can is open... the worms are everywhere."
Hands down the most powerful shell there is.
-- ;-)
Kuro5hin.org: where the good times never end.
Shells
I originally chose this shell back in '92 for the right hand prompt. A 'spiff' feature for a shell chocked full of features. It was also the first shell to have a truly programmable completion. It has all the interactive add-on's for tcsh, with the base template built off of Korn Shell (so you don't have issues with scripting in something separate from a Bourne derivative).
The z-shell is so filled with features at this point, it's nearly become the "emacs" of shells, and yet, it's memory footprint for the same tasks is smaller than either bash or tcsh.
My wife thinks I'm insane, but I'll show her! I'll show them all!
This sig no verb.
Royal Dutch?
While features like a commandline history are nice, while you are at it, why not try something like the MUD Shell or the New Adventure shell? Instead of some plain black, dull shell, spice unix up with a gameplay like feeling. Interestingly, The MUD shell, was inspired by a posting at... Slashdot!
Tab and Shift-Tab to *cycle* thru filenames, along with a hotkey to toggle between long and short filenames, just rocks when stuck on a Windows (2K/XP) box.
When on a *nix system, bash.
Geez, people! ;-)
I suffer from attention surplus disorder.
When picking a shell, you should consider:
The candidates:
sh is too primitive in terms of user features, period. No one uses the Bourne shell if they can help it.
csh/tcsh...well, google for "csh Programming Considered Harmful" to see its many internal bugs. Also, most of the major Unices don't use it (Solaris, AIX, Linux - I guess *BSD might still) for their system stuff. If it's not considered a good scripting platform AND most Unices don't use it for their scripts...
zsh - From what I've read, a good shell, but very nonstandard. Do you really want to lug a shell around and install it (and set up /etc/shells or whatever each time, etc.) for every machine you log into?
ksh - sh scripting with all the good interactive features. A really solid shell and a very good choice. All the sh goodness with the t/csh interactive features added.
bash - I think bash is a little better than ksh because some of its interactive features are better. Tab-completion is better than ESC-\. The way the shell handles tab completion is better (X possibilities, do you want to see?) Lots of little things like that. Benefits greatly from reimplementing ksh. Installed by default on all Linux distros (except tiny niche players) and Solaris since Solaris 8...easy to build and install on AIX or *BSD (and HP-UX I'd guess, I don't know)
bash is the best shell in my opinion and I have no qualms about defending it. ksh is a reasonable second choice and some people prefer it. zsh may be in the running but never caught on widely. Everything else is inferior.
Advice: on VPS providers
EVERYTHING ELSE IS INFERIOR.
I'm not a shell guru, so my opinion doesn't matter much, but I use bash or tcsh. *shrug*
Quidquid latine dictum sit, altum sonatur.
Real men have a perl script to search through all .h's and .so's on the system, and make up an executable including and linking them all, and just printing "hello, world.".
Then they run that in GDB and break. Instead of rm they use "p unlink("file");" Occasionally they might break down and use "system("shell command\n"); but only if no one is looking.
On AIX machines I use tcsh as my interactive shell, but write scripts in ksh, and drop into ksh if I want to test something out. ksh is great for scripting but really sucks for interactivity.
On Linux machines I go with Bash...it's the best of both worlds, but does use a lot of memory at cold start (~5 megs last time I checked).
I've heard great things abotu zsh, but haven't really tried it.
By the way, does anybody else think that readline is the most evil thing on the face of the earth?
It's 10 PM. Do you know if you're un-American?
4NT (and 4DOS and 4OS/2). That whole line of 4* shell products is really great.
I prefer the adventure shells.
The core cannot defend itself. It dies.
"It is our blasphemy which has made us great, and will sustain us, and which the gods secretly admire in us." - Zelazny
We use bash/bourne shell for scripting because it's available on every operating system, and its behavior is reasonably predictable. It would be insane to write a shell script in tcsh, for example (not that I haven't done it... :').
However, if you really want to write a quick script, something like Perl or Python is a better choice, unless you really need that portability. And if you really want a nice UI, well, you should use what works for you.
On that basis, I use tcsh. it is not superior to bash - if anything, bash is, taken as a whole, superior to tcsh. Likewise ksh. But I'm not using all the features of ksh or bash, and because of my own personal history - what I imprinted on - I find tcsh much more predictable. Its behavior is also more similar to emacs' behavior than bash's behavior, and I use emacs. So for me, tcsh is the right choice.
You said you use tcsh elsewhere. So to some degree you've probably imprinted on it. It's brave of you to decide to check out the competition, but it's going to come down to a matter of personal preference, so my advice to you is to personally check out the competition - don't take our word for it. This is a productivity tool, so pick the one that works nicely for *you*.
Having said that, the obvious competition to tcsh is bash, and it's getting to the point where it's pretty much ubiquitous, so that is what I'd suggest you check out. Switch to bash for a month. Try to customize it to your liking. After a month, switch back to tcsh. If you find yourself missing bash, switch back to bash. If you find yourself happy and relieved to be back home, stick with tcsh. If you find yourself still on the fence, use bash, because it's more likely to be installed on random machines that you log into (into which you log?).
But bash gets my vote. I had the same problem when I installed NetBSD. I had to suffer through using sh untill I could networking up. Bash was the first thing I downloaded.
-73, de n1ywb
www.n1ywb.com
Some random facts:
The only real choices today as far as user login shells go are bash 2.x, ksh (ksh93, not ksh88), and zsh, all of which continue to cross-pollinate good ideas.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
i was convinced by adam spier's page and the zsh faq to give zsh a try - it was even a netbsd system that prompted it. i got sick of administering freebsd/opensbd/netbsd with different shells and i wanted to standardize on something with the features i wanted.
:) the basics are largely identical.
bash was tried first, but when i started playing with misc options like vi mode, got deeper into completion, etc i realized that bash/ksh weren't appropriate long-term choices for me. auto cd to directories, amazing completion options, typo correction, shared history, and a proper vi mode (see this for the confession from gnu's docs).
'knowing' zsh will largely translate to bash/ksh systems when you use them and zsh is not available - you'll just be reminded of their shortcomings
the new unix power tools book also makes much mention of zsh.
I've only begun leanrning unix, IM a system admin at a small non-profit. I actually find it my easier to write python scripts for things that would normally require bash scripts.
Could I hear your thoughts about this approach?
Thanks
Sigs are dangerous coy things
Bash.
This is a preference thing more than anything else. If you want tcsh on NetBSD cd /usr/pkgsrc/shells/tcsh && make install
I've used csh, sh, tcsh, ksh, and bash. I think at one point I used zsh. I found that tcsh, bash and zsh are usually similarly setup, and allow using the arrow keys and tab completion. History is something that you set up, and in these 3 shells its always been setup for me. In using ksh, csh and sh, my experience was eew eew eew, but that is just me. I was used to bash at that point. Bash can be a hog or so I am told. I never measured, ub tit does a lot and it is probably not something you'd want if you were building a flopy based distro. Tcsh is not that bad, and can be added nowadays to just about any UNIX platform. Zsh is supposedly better, but I never used it enough to know if it truely was.
If you are going to do shell scripting then I'd suggest sh for shell scripting. Of course you can write scripts in sh and use tcsh or any other shell if you know what you are doing. Uisng sh for scripting is more portable than perl, tcsh, ksh or bash, as sh is going to be on all modern unix systems. Perl may be on all systems, but don't rely on it. Csh does not allow shell functions, which are kinda handy. Ksh is Suns shell (I think) and I know it is not available on every platforms.
What do you prefer to use that is the real question. Personally I can make just about any shell work for me if I have to....
Only 'flamers' flame!
Personally I'd use bash. The primary reasons I guess are it's resamblance to ksh, my previous perference, and the fact that it comes default with RH linux, which I am running here.
Besides command line history and editing, I perticularily like the tab search feature. It's saved me a lot of effort typing full paths.
Korn is a great shell, and he is constantly working on it, so it is getting better and better.
It is the shell I find most often on the commercial boxen that I need to work with, so I use it on linux and freebsd too. I'm certain that there is a version available for netbsd too. pdksh is a distant second to the real thing, so go grab the official ksh! It isn't pure from an open source viewpoint, but I am answering in terms of practicality not idealism.
You can grab it from att labs' page if I remember correctly. It is the gold standard for 'correct' behavior as far as I am concerned, and is what you will find on a whole slew of different *nix boxes.
I try to avoid bash, because though it is a really nice shell, I never find it on commercial systems, and I want my shell to behave consistently wherever I am.
Cuchullain
"If sharing a thing in no way diminishes it, it is not rightly owned if it is not shared." -St. Augustine
Somewhat saner syntax in places but missing a couple of things. It is nice and small however.
I use a sh derivitive on Unix/Linux machines. I prefer in order of preference bash, then korn, then tcsh, csh, sh
Command line editing and history is important during normal use. After than it is the programming structures you prefer.
Being someone who was weaned on a Altos running System 7 back in 1984, I prefer bourne shell dirivitives.
I'll be modded down for this but:
root shells.
Granted, this topic is geared towards nix shells, but when you're stuck with windows no shell comes close to rivaling the power and flexibility of LiteStep.
When I first used UNIX, it was ksh. I had gotten used to ESC-ESC for name completion. Then I got my NeXT and liked TAB for completion under csh. Much better. When I found out that bash had the same thing but TAB-TAB prints all possible matches, I was hooked from then on. Plus, much of the settings are the same as ksh and scripting is about the same.
I tried zsh but its man page is like Perl's, referencing a bunch of other man pages, making navigation/reference cumbersome. tcsh's configuration is different enough from [bk]sh's that I stopped using it in short order.
So it's bash for me. It's a good thing bash is available under OS X. Early versions had only sh, csh, and tcsh and things were painful. Recent versions have all those, including bash and zsh.
is EXPLORER.EXE in Windows XP.
There certainly is a history in the default shell (/bin/csh) on NetBSD. Type the 'h' command to see your numbered command history. Then type, for instance !3 to repeat the third command on the list, or !! to repeat the most recent command.
But if we wanted to have a shell war, maybe I am just being pedantic and interfering.
I would vote for zsh, personally.
I've actually had bash segfault on me a few times, which zsh has never done. and zsh uses less memory unless you do abusive things via scripting or the command line editor. zsh scripting is a superset of sh, so the things I try generally work; csh users can have a similar experience after setting a few options. (But remember, csh programming Considered Harmful.) I've become accustomed to spiffy zsh features like reporting when other users log in and out (before the prompt, just like new mail), extended globbing, very customizable completion behavior, being able to tab-expand history references (makes trying "!rm" much less dangerous), and so forth.
It's even the little things. Like, zsh expands commands when it prints a job completion report, but bash doesn't; so if you have a loop which does something on a bunch of items, each of which can complete in the background, under bash you get a report where each item looks like "[%] Done wget $i" or something equally useless, but under zsh you can see the actual text of the command that finished.
I have 100+ lines invested in the four rc files for zsh by now, so something new might not be immediately superior for me. I have been meaning to seriously try out es and rc for years.
Java: the COBOL of the new millenium.
csh/tcsh...
/etc/shells or whatever each time, etc.) for every machine you log into? ...
I'm really disappointed that this is the default shell in OS X. Using tcsh is downright painful for anyone used to real tab-completion (e.g., zsh, bash).
zsh - From what I've read, a good shell, but very nonstandard. Do you really want to lug a shell around and install it (and set up
bash - I think bash is a little better than ksh...
If you're a bash user for the interactive benefits (i.e., tab completion, etc.), then you should really consider converting to zsh. It will take you a day, but you'll be glad you spent the time and you'll never go back (unless you're forced to, in which case it will be painful).
Aside from the "embrace and extend" approach of these shells that a previous poster mentioned, zsh wins by a light year compared to anything else, especially with its tab completion libraries (imagine being able to hit TAB after typing cvs to get a list of the subcommands). Not only that, but zsh history/command-line editing are far superior (with a true emacs-style kill ring and real multi-line command editing). The learning curve can be steep, but there are plenty of tutorials out there to get you started. zsh is the power user's shell of choice if you spend any time in the shell (this is coming from a six-year bash zealot).
moto411.com
All I've ever used on a machine is tcsh and I simly think it's the best no matter what anybody says.
Of course I realise you're joking, but Emacs actually does come with a built-in shell, eshell.
What rocks about it is that it's written in Emacs lisp, so you can use it on anything Emacs runs on. It's very nice to be able to fire up a Unix-like shell on Windows for those of use who prefer a cli approach and have never adapted to the MS-DOS tradition.
Still though, when I am in a Unix environment I like zsh for my login shell, which still has a more features.
I'm also a zsh fan and highly recommend it; but think it's relevant to this discussion to point out that people should be very cautious about tinkering with root's login shell:
A lot of shells are not useable in single-user mode. This means that if you change root's shell, you risk getting yourself an unusable system if a later problem forces you to boot in single user mode. (To check if this is the case on your system, boot into single-user and try to start the shell at the first prompt you get.)
So my advice is zsh for user logins, and leave root at whatever your system's default is.
If you try zsh and you don't think it is worth the bother to lug zsh around, you didn't have much need for zsh in the first place.
I lug zsh everywhere. Do I really want to? Absolutely.
I've been using and programming in Bash for years and yes some of the features like history and tab completion are cool but the real power is in the scripting. I use bash scripts everywhere: backups,parsing files, logging greps to e-mail and in conjunction with numerous other languages that need access to the "system". the true power is in the language that comes with the shell.
--K
"Talent does what it can; genius does what it must."
I would have to agree with several previous posters, that Bash is the best. The reason why? It is powerful, it is popular, and it is easily scriptable.
ksh and zsh have their followers, but they tend to be older unix wizards who didn't ahve bash to cut their teeth on. They only keep using zsh and ksh because it is comfortable.
In the future, I am sure there will be more innovation done on Bash, and perhaps a few forks as well. I hope that the shell paradigm will be rethought from the beginning to the end. I don't have a solution, but I have a gut instinct that there is something better out there.
The radical sect of Islam would either see you dead or "reverted" to Islam.
I use tcsh for my day in/ day out usage. Bash was actually my first shell, but I didn't use it much (I used it to work with my web/ftp accounts on a remote server at the time). Since then, I have done a lot of stuff in tcsh, and have configured a lot of it to what I want to do. For normal interactive useage, it has been good to me.
However, I couldn't really recommend that you make shell scripts in it. I usually make my shell scripts for straight up sh (when I do make them), but more often than not, I use Perl or Ruby to get scripting jobs done.
However, I since I have not extensively used bash, I really can't tell anyone what I think about it (for comparisons). tcsh has always been good enough for me, and so I haven't bothered to configure bash on my system, but I'm sure if I took the time, I would consider it a good shell.
It's not really sensible to write shell scripts using one shell and use another, so steer clear of csh.
poppycock
I use csh all day long for my interactive sessions but use rc for my shell programming.
So pray, what's wrong with doing that?
I get the features I want from a CLI and I get the features I want from the shell programming language for scripts.
There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
I don't mind telling you that I use Bash under linux, but before I found out about fink on mac os x I used the default tcsh, and hey -- it's great. It's actually become my preference. This may sound strange, but little things like the way it handles environment variables is what cinched it for me.
- Cloud
While surfing the web for FAQs on UNIX shells, I came across this popular FAQ on the differences between shells and how to choose.
There's a great table in there that lists the features of each.
I made a couple of mistakes. I called him Rob Mashey. Actually, it is John R. Mashey. And he felt the PWB shell he worked on was still a Thompson shell. I found a reference where he graciously said he was the third of three people to work on what he disliked hearing called "the Mashey shell".
Programmable completion has been in bash for a while now. See the original project page for more, or use the debian bash package, which includes the completion libraries by default.
I actually had to disable the cvs-subcommand-autocomplete. I would try to complete the name of an actual file, and the cvs-completion would fire... generating network traffic to the CVS server... taking forever... when all I wanted was a local filename.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Yeah, I read the article. It's from 1996 people. 6.5 years ago. Move on.
Besides the article is horribly written. It takes him three pages to say "redirecting file descriptors is inferior to sh". Another page to say "quoting sucks". The rest is either petty or doesn't exist in tcsh.
And he can't decide if he doesn't like csh as a login shell or as a scripting language or both.
I admit to writing scripts in csh instead of bash. In reality both suck. If I need something so complex I need functions I am NOT using bash or csh.
Bash and csh as programming languages suck when compared to C, C++, Java, Perl, Python and LISP. But I'm not about to make emacs my login shell (again).
My login shell is tcsh. There are things I hate about bash/readline. YMMV. Use the right tool for the job. Not available in Tennessee.
"The cost of freedom is eternal vigilance." -Thomas Jefferson
When I'm the root user, my shell is
Ever. Ever. EVER. Instead, in root's
All my scripting is done using
For simple sysadmin-type tasks, the bourne shell has almost all the features you need
--NBVB
If you want a small memory footprint, try the embeddable shell alternative: BusyBox.
"BusyBox has been written with size-optimization and limited resources in mind. It is also extremely modular so you can easily include or exclude commands (or features) at compile time. This makes it easy to customize your embedded systems. To create a working system, just add /dev, /etc, and a kernel."
I never write scripts in csh (I use perl or sh) but I still use csh as my interactive shell, because (aside from trivially launching programs) the most common thing I use any of the actual syntax of the shell for is pounding out stuff like:
djpeg $f | pnmscale
end
sh/bash don't support the $var:r and related syntaxes, and so it's a lot more typing to do:
djpeg $f | pnmscale
`echo $f | sed 's/\..*/-thumb.jpg/'`
end
I call it gsh (Geoffrey Shell). This was an assignment I had in grad school that somehow never ended.
It isn't very full featured, and as far as a scripting shell goes it is somewhat buggy - but if I need some programming done I use C or Perl.
However it does the stuff I want it to do!
I could GPL and release the source, but in all honesty everyone I have gotten to try it hates it. I like it tho. And if it pissed me off I have no one to complain to but me.
All you out there who like to complain about shells other people write: get off your rear and write your own.
So there.
I am very small, utmostly microscopic.
Really, the backward compatibility argument will keep you backwards forever. Zsh is by far the most advanced shell; unless you're constantly logging into several machines daily it is easily the best choice. Not to mention, the more you use it, the more popular, and thus ubiquitous, it becomes.
It is the default shell for many Linux floppy distributions. It does NOT have command line completion, but when it comes to memory usage, you should really look at it.
Troll: Large Giant, 63 hp, AC 16, Usually chaotic evil.
Funny, I've run bash for a while because I didn't need anything more (depsite using fancier shells at an earlier age) and was just this week about to switch off of bash after running the following command in my ~/misc directory:
.*
.* to include .. and was changing the permissions on my home directory, thus triggering ssh's security paranoia. I wonder if the same sort of thing happens to other people? Gee thanks, bash!
chmod g+w *
chmod g+w
After I ran that, I couldn't log into the machine. After much agony and troubleshooting in the dark, I later realized that bash was expanding
There may not be a fancy set of commercials saying why folks switched to zsh. There are some resources for the bash or tcsh user who wants to convert to or try out zsh. These can found here This page includes links to some how-to type information, and some tools/scripts that convert/adapt completion functions.
I am not sure if I have a favorite *nix shell.
But it does lead you to wonder why no one has made a turtle shell. Or being risky in these times why not a bomb shell.
The nameing of shell environments in *nix seems to stray away from any 'real shell' naming.
Regards,
Ryan Pritchard
Fun Extends All Basic Life Expectancies
C:\>dosshell
OH YEAH!!!!
I use the rc shell, originally from the Plan 9 operating system, for my personal systems. The minimalist philosophy and syntax makes scripting simple (modulo some awkward syntax for if/else logic), and the nestable backquoting syntax combined with GNU readline (optional) makes it simple to iteratively hack up nested 3-level-deep pipelines on the fly. One minor drawback for interactive use is that working with file or directory names containing spaces is not that smooth.
When on other people's Unix systems, whether for interactive work or scripting, bash is the shell of choice. It's almost always there (and if it isn't, it's easy to build a local copy, it runs on virtually any system). The filename completion is fantastic, and compatibility with vanilla sh makes scripts portable (just avoid the bash specific features).
For Windows, I use Cygwin+bash. That combination turns my Win2k PC at work into something usable.
One complaint people have about zsh is that it is not as readily available as other shells. Zsh is readily available with Cygwin. And there is a command "mkzsh" that will create a shortcut icon like the one for bash.
/zsh.bat if the shortcut created doesn't work properly.
Note: You may need to edit