The Shell Game Part 2: What are your shell choices?


Published on

Continuing the exploration of the Linux Shell we look the various shell options you have.

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

The Shell Game Part 2: What are your shell choices?

  1. 1. The Shell Game 2 Kevin O'Brien Washtenaw Linux Users Group
  2. 2. Varieties of Shell ● In Linux, you always have choices, whether you like it or not ☺ ● With shells you have choices ● The Bourne-Again Shell (bash) is most likely the default you have on your system now ● But you can use others as well
  3. 3. Why use different shells? ● Like any other choice, you would select different shells because they have special capabilities you want to make use of ● They may have special commands, or use less resources, or maybe you just feel more comfortable with one shell rather than another
  4. 4. Bourne shell (sh) ● The original Unix shell ● Written by Stephen Bourne at Bell Labs in 1974 ● A simple shell, with small size and few features ● Every Unix-like system either has sh, or has a shell that incorporates everything in sh
  5. 5. Bourne-Again Shell (bash) ● The default for all Linux systems ● Also runs on virtually all Unix-like systems, and there is even a version available for Windows ● Bash is a superset of sh, that is, it incorporates everything that is in sh, but then adds to it ● It is very flexible, and a good choice for beginners. The rest of this series will use bash to illustrate using a shell.
  6. 6. Almquist Shell (ash) ● Basically a clone of sh ● Very small memory requirements ● Thus it is useful for small embedded systems
  7. 7. C Shell (csh) ● Created by Bill Joy while he was at UC Berkeley ● Syntax very similar to the C programming language
  8. 8. Korn shell (ksh) ● Developed by David Korn at Bell Labs in 1983 ● Superset of SH, with many features of the C Shell as well ● Advanced scripting capabilities similar to what is in awk, sed, and perl
  9. 9. TENEX C Shell (tcsh) ● Based on C Shell ● Adds features not found in C Shell ● Now the default shell on some BSD systems (FreeBSD and Darwin)
  10. 10. Z Shell ● Written by Paul Falstad around 1990 ● Simlar to ksh, but has features from csh as well ● Attempt to use the programmability of the ksh with csh features
  11. 11. You can choose ● You can make a temporary switch of your shell ● Or you can change the default if you find one you like better
  12. 12. Temporary switch ● A shell is an executable file (everything in Linux is a file) ● So you just run it ● For example, to change to the original Bourne shell, just type “sh” at the prompt ● To go back to the Bourne-Again shell, just type “bash” at the prompt ● When you change, notice that the prompt itself looks different
  13. 13. Changing the default 1 ● Suppose you find a shell you like better, and you want that to be the shell you always want to see when you boot up your computer ● First, find out the full path of the shell, i.e., what is the full path, starting from the root, to the executable file that contains the shell ● To get clues, open up /etc/shells and etc/passwd ● For example, bash is usually /bin/bash
  14. 14. Changing the Default 2 ● Once you know the full path to the shell you now want to be the default, use the change shell command (chsh) ● This will open a brief dialog to make the change, and will ask you for your password to authorize it
  15. 15. Whose shell is this, anyway? ● One thing you need to remember is that the choice of shell is only being made for the person logged in ● You could have multiple users on a system, and have each one make their own shell choice ● Tip: always try out a shell temporarily before making a permanent change