- Discovering What Shell You're Using
- Understanding Shells and Options
- Changing Your Shell with chsh
- Changing Your Shell Temporarily
- Using Completion in the bash Shell
- Viewing Session History in the bash Shell
- Using Completion in the zsh Shell
- Viewing Session History in the zsh Shell
- Using Completion in the ksh Shell
- Viewing Session History in the ksh Shell
- Viewing Session History in the csh Shell
- Changing Your Identity with su
- Fixing Terminal Settings with stty
- Exiting the Shell
Changing Your Shell Temporarily
You can change your shell temporarily by creating a subshell and using that instead of the original shell. You can create a subshell using any shell available on your Unix system. This means that you can look in the /etc/shells file and use a shell listed there, or you can use a shell installed elsewhere on the system (Code Listing 3.6).
Code Listing 3.6. Checking the list of shells from /etc/shells and looking for other programs that end with "sh" is a good way to find all of the shells on the system.
[ejr@hobbes]$ cat /etc/shells /bin/bash /bin/sh /bin/tcsh /bin/csh [ejr@hobbes]$ ls /usr/local/bin/*sh /usr/local/bin/pdksh [ejr@hobbes]$
Code Listing 3.7. Type in the shell name (which is really just another Unix command) to change shells.
[ejr@hobbes]$ /usr/bin/csh ejr>
To find out which temporary shells you can use:
At the shell prompt, type cat /etc/shells to find out which shells are listed in the shells file.
If you don't find a shell you want to use in the shells file, look for other shells installed elsewhere on the system.
At the shell prompt, type ls /usr/local/ bin/*sh to find additional shells in the /usr/local/bin directory. Note that not all programs that end with sh are shells, but most shells end with sh (Code Listing 3.6).
To create a temporary shell (subshell):
At the shell prompt, type the path and name of the temporary shell you want to use. In this case, we're using the csh shell, located at /usr/bin/csh. You might see a new prompt, perhaps something like the one shown in Code Listing 3.7.
To exit a temporary shell (subshell):
At the shell prompt, type exit. You'll be returned to the shell from which you started the subshell. If you created more than one subshell, you'll have to exit all of them.