- 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
Fixing Terminal Settings with stty
Another handy thing you can do with your shell is use it to fix those annoying problems that occur with terminal programs. Back in Chapter 1, we mentioned that you might encounter oddities such as your and keys not working properly. You can fix these problems using stty (see Code Listing 3.16).
Code Listing 3.16. You can often straighten out a confused telnet program or Unix system by using a stty command. This one fixes the errant key.
xmission> ls ^?^?^?^? : No such file or directory xmission> stty erase '^?' xmission> ls
Code Listing 3.17. The stty command here fixes the key to work like .
xmission> jf^H^H jf^H^H: Command not found xmission> ls ^H^H : No such file or directory xmission> stty erase '^H' xmission>
To fix and key oddities with stty:
-
stty erase '^?'
If you're used to erasing characters to the left of the cursor and you just get a bunch of ^? symbols on the screen when you try it, you need to educate the terminal about your preferences. Type stty erase to fix it (Code Listing 3.16).
In some cases, depending on your terminal program, you might need to set stty erase '^H' and then use to backspace. To enter this command, type stty erase '^V' (Code Listing 3.17).
To fix general terminal weirdness with stty:
-
stty sane
Typing stty sane at the shell prompt will fix a lot of oddities. For example, if you accidentally issue a bad command and all of a sudden nothing shows up on the screen or if you have general gibberish showing up on the screen, stty sane may return your terminal session to sanity.
The reset command is also often effective at fixing a messed up terminal.