The FreeBSD Diary

The FreeBSD Diary (TM)

Providing practical examples since 1998

If you buy from Amazon USA, please support us by using this link.
Changing the shell (bash) 26 July 1998
Need more help on this topic? Click here
This article has no comments
Show me similar articles
see also Shells
Why a new shell?
The shell is that part of the system which accepts your command and interprets what you have said.  It launches other commands.  The shell you get by default is not the only shell around.  I chose the bash shell, mainly because it has a command history.   If you're ever typed a long command, only to have it rejected because you mistyped it, then a shell history is what you want.  It allows you to recall previous commands, modify them, and resubmit them to the shell.

It was during the CD-ROM saga that Jay advised me to make "installing a new shell" a high priority.  Well, that was over two weeks ago, and I'm only just doing it now.

You might also want to see UNIX shell differences and how to change your shell (Monthly Posting).

Finding the shell
My first step in replacing the shell was finding out what CD the ports are on.   For the record, it's the 4th CD.  I found this out by using my NT box and scrolling through the directories.  Then I transferred the CD over into my FreeBSD box.  The following commands allowed the CD to be mounted:

mount -t cd9660 /dev/wcdoc /cdrom

This command allows you to view the contents of the CD-ROM by using the /cdrom directory.

Building the shell
After mounting the CD, I searched the FreeBSD handbook to find out how to install a port.  I was installing from CD-ROM, but you can also install from the Internet.  I just followed the instructions and everything went exactly as expected.  Here are the commands I used, but you really should follow the instructions found on the FreeBSD webpages found above.

updated.gif (950 bytes) Please note, that the following instructions contain extra steps.  See Building a port - background info on make for more concise information.

# mkdir /usr/ports
# cd /usr/ports
# ln -s /cdrom/ports/distfiles distfiles
# cd /usr/ports
# mkdir shells
# cp -R /cdrom/ports/shells/bash shells
# cd shells/bash
# make install

The above make took less than ten minutes to run.  Then you must tell FreeBSD that you want to use this new shell.

Installing the shell
Just making the shell isn't enough.  You must tell FreeBSD that you want to use this new shell.  There are two steps to this process.  And thanks to Togrul on undernet's #freebsd channel for help in this area.
  1. add /usr/local/bin/bash to the /etc/shells file.
  2. run chsh and change the Shell: line to point to at /usr/local/bin/bash

Once you have done this, all you need to to is login again.  I did this from another virtual terminal just in case I had done something wrong.  ALT-F1, ALT-F2, ALT-F3 will take you from one virtual session to another.

NOTE: When upgrading to 2.2.7 and installing to a new disk, I found that step 1 above was already done for me.  But that was bash 2.2, so perhaps they do that automagically.

Cleaning up
After doing all of this, you should clean up the diskspace which was used during the install but which is no longer needed.  Use either of the following commands (again, thanks to Togrul):

make clean


make distclean

The first command cleans up the build area.  The second command also deletes the downloaded files.

Need more help on this topic? Click here
This article has no comments
Show me similar articles