Fixing Terminal Settings with stty


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.

Tips

  • If stty sane doesn't fix a messed-up display, try logging out and logging back in or restarting your terminal program.

  • You can fix oddities permanently by adding the appropriate stty command to your configuration files or by making changes in your terminal client. See Chapter 8 for details about your configuration files. Refer to Chapter 1 for more helpful details about terminal programs like SSH and telnet.





Unix(c) Visual Quickstart Guide
UNIX, Third Edition
ISBN: 0321442458
EAN: 2147483647
Year: 2006
Pages: 251

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net