Using chshIn our discussion of shells earlier in this book, we have talked many times about either what shell you are using or what shell prompt commands you can perform. We have also touched on why you may want to change your shell, and now we will cover how to do just that within your Unix environment. In the beginning of this book, you learned that there are a variety of different shells that you can run; we covered most if not all of them. There will be times when you will want to change your shell, and to do that, you can use the change shell command, or chsh. The chsh command will allow you to choose one of the shells that is registered for use on your machine. This means that you must have a shell on your system in order to request it. One problem you may encounter is not knowing which shell to choose; after all, there are so many shells, and how do you know which ones are registered for use on your system? To help solve this problem, you can use the chsh command with the l option. The chsh l command will list out all the available shells on your system. After using chsh l, changing shells is as easy as running the correct command and knowing what syntax to use. >chsh -l /bin/ash /bin/bash /bin/csh /bin/ksh /bin/sh /bin/bsh /bin/tcsh /bin/zsh In this example, there are eight different shells that you can choose from. If you wanted to change to the bash shell from your current shell, you would do the following: >chsh Changing shell for rob. Password: ***** New shell [/bin/csh]: /bin/bash Shell changed. The next time you logged in to your machine, you would be in the bash shell instead of your previous shell. You probably won't ever need to change your shell unless the default shell on your system is not able to do what you want it to.
Now that you have changed the default shell in your Unix system, you can either keep it that way or change it back. For the next portion of the lesson, you should be in the shell most comfortable to you. If you changed into a shell you are not familiar with, you should change back to the shell that you usually work in so that you can follow the rest of the lesson's exercises. |