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

15

Click here to load reader

description

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

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

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

The Shell Game 2

Kevin O'BrienWashtenaw Linux Users Group

http://www.lugwash.org

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

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

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

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

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

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

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

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.

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

Almquist Shell (ash)

● Basically a clone of sh● Very small memory requirements● Thus it is useful for small embedded systems

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

C Shell (csh)

● Created by Bill Joy while he was at UC Berkeley

● Syntax very similar to the C programming language

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

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

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

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)

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

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

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

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

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

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

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

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

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

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

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

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