geekvenue.net

Welcome to Chucktips Hardware HELP WITH DEAD OS Installing FreeBSD Miscellaneous
 faq
 search
 add article
 cool-stuff
 how-to
 main
 tips


HOWTO: Change your Shell, What is a Shell?
Documentation Posted by Understudy on Sunday October 20, @01:06PM
from the picking up shells off the beach dept.
So you want to change you shell. That is not a problem. So long as you know what a shell is. Here you will get a quick definition on what a shell is and how to change them.
This will not cover why to change them except to say that it is a matter of personal taste and what your needs are.
Definition of a Shell:
A UNIX shell is a point at which you can place input. To complicated? Yeah I thought that definition was lousy also.

The shell is basically a prompt at which you can type in your commands. There are a lot of different types of shells and it is hard to tell them apart. If you have a windows/DOS background, you will be familiar with this:

C:\> or C:\Windows\Desktop\> or even A:\ if you are at your floppy drive.

That is a DOS shell, specifically this is the prompt for a DOS shell. Nothing fancy and it can't do anything until you tell it. For example you can type:

C:\ dir

This basically asks the DOS shell to "print to your screen" a copy of the directory of the C drive.

Let us look at shells in FreeBSD.

Wait a minute he said shells as in plural.

Yup, there is more than one and they can do different things.Let me give you the names of some of the more common shells.

Bourne: the standard default shell for non root users in FreeBSD. You can read about the shell by looking at the "man sh" pages. Uses abbreviation sh.

Korn: a shell developed by AT &T. You can read more about it by looking at the "man ksh93" pages. Uses abbreviation ksh or ksh93.

Bash: The Bourne Again SHell. You can read about it in the "man bash" pages. Uses abbreviation bash.

Z-Shell: The Z shell. You can read about it by looking at the "man zsh" pages. Uses the abbreviation zsh.

C-Shell: The C shell. You can read about it by looking at the "man csh" pages. Uses the abbreviation csh. This is the default shell for root.

TC-Shell: Basically the same thing as above. They are a little bit different, but not very much so they now fall into the same category. You can read about it by looking at the "man tcsh" pages. Uses the abbreviation tcsh.

Note: I get the same man pages whether I type man csh or man tcsh. So I suspect the differences are minimal.

Okay so what the heck are the "man" pages?

They are the manual pages for a program. If you have loaded the package or port you can type man xxxx at the prompt and they will come up. Or you can type man xxxx (xxxx is the abbreviation of the shell) in a search engine and many people host them on their sites. If you need to install a port or package go here. We can wait until you are done.

How to find out what shell you are running:

type at prompt:

echo $SHELL

Here is what you may see:

/bin/sh : This is the Bourne shell.

/bin/ksh93 : This is the Korn shell.

/bin/bash : This is the Bash shell.

/bin/zsh : This is the Z shell.

/bin/csh : This is the C Shell.

/bin/tcsh : This is the TC Shell.

You may see /usr/local/ also in the result.

You must have installed the shell in order to be able to change to it. You can find the shells you have installed by doing this:

ee /etc/shells

This will bring up the editor and you will see listed the shells that have been installed and where they have been installed.Here is a copy of mine:

# $FreeBSD: src/etc/shells,v 1.3.2.1 2000/07/10 08:47:17 obrien Exp $
#
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/ksh93
/usr/local/bin/zsh
/usr/local/bin/bash

Press ESC to get out of the editor. ( you shouldn't have made any changes ).

Okay You have installed the shells and you want to change them. Let us make some notes here:

1. Do not change the root shell to anything other than csh or tcsh. This can cause problems.

Changing the shell:

At prompt type this:

chsh -s /usr/local/bin/bash

The chsh is a command that means change shell.

The -s sets it for you without having to go into the editor to do it.

The /usr/local/bin/bash tells your profile where to find the shell. It could have easily looked like this:

chsh -s /usr/local/bin/ksh93

chsh -s /usr/local/bin/zsh

chsh -s /bin/sh

chsh -s /bin/csh

chsh -s /bin/tcsh

Okay you did the command and it went ok.but the echo says it is the same. Log out and back it for the change to take effect.Then do echo $SHELL. You should see it show the new shell.

That is what you would have to type to change a shell. and you can always change it back doing the same thing. Now I am sure you would like to research shells and their differences.

You can read these helpful articles.

UNIX Shell differences and how to change your shell by Brian Blackmore
General Shell Information Author not listed.
UNIX Shells - csh,ksh,bash,zsh,... by Christopher Browne
UNIX 101: Finding and Changing the Shell no author listed.

Also please read this you will find it helpful:

FreeBSD Handbook section 3.7 and 3.7.1 As much as I despise the handbook. this was actually understandable to a certain degree.
FreeBSD Handbook section 9 I even liked this although it took me reading through the other articles to understand it.


<  |  >

 

Related Links
  • Articles on Documentation
  • Also by Understudy
  • Contact author

    Lilliput Mini USB Computer Monitor

    If you have ever wanted to learn about Cisco Routers, check out my new book "Cisco Routers for the Small Business" - it's Cisco CLI for the Regular Guy!

  • Sponsors

    The Fine Print: The following comments are owned by whoever posted them.
    ( Add a Reply )

    "You never know how many friends you have until you own a Condo on the beach." -- Jason's Postulate

    Powered by Zope  Powered by Apache  Squishdot Powered
    All trademarks and copyrights on this page are owned by their respective companies. Comments are owned by the Poster. The Rest ©2001 Jason Neumann.
    [ main | post article | search ]