## 1.4. The Unresponsive Terminal

During your Unix session (while you're logged in), your terminal may not respond when you type a command, or the display on your screen may stop at an unusual place. That's called a "hung" or "frozen" terminal or session.

(Note that most of the techniques in this section apply to terminal windows in a window system, but not to nonterminal windows such as a web browser. In Chapter 2, Section 2.7 should help with windows in general.)

A session can hang for several reasons. For instance, the connection between your terminal and the computer can get too busy; your terminal has to wait its turn. (Other users or computers probably share the same connection.) In that case, your session starts by itself in a few moments. You should not try to "un-hang" the session by entering extra commands because those commands will all take effect after the connection resumes.

If the system doesn't respond for quite a while (how long that is depends on your individual situation; ask other users about their experiences), the following solutions usually work. Try the following steps in the order shown until the system responds:

1. Press the RETURN key once.

   You may have typed text at a prompt (for example, a command line at a shell prompt) but haven't yet pressed RETURN to say that you're done typing and your text should be interpreted.

2. If you can type commands, but nothing happens when you press RETURN, try pressing LINEFEED or typing CTRL-J. If this works, your terminal needs resetting to fix the RETURN key. Some systems have a reset command that you can run by typing CTRL-J reset CTRL-J. If this doesn't work, you may need to log out and log back in or turn your terminal off and on again. (But, before you turn off your terminal, read the notes earlier and later in this chapter about turning off the power.)

3. If your shell has job control (see Chapter 7), type CTRL-Z.

   This suspends a program that may be running and gives you another shell prompt. Now you can enter the jobs command to find the program's name, then restart the program with fg or terminate it with kill.

4. Use your interrupt key (found earlier in this chapter in Section 1.1.8--typically DELETE or CTRL-C).

   This interrupts a program that may be running. (Unless a program is run in the background, as described in Section 7.1 in Chapter 7, the shell waits for it to finish before giving a new prompt. A long-running program may thus appear to hang the terminal.) If this doesn't work the first time, try it once more; doing it more than twice usually won't help.

5. Type CTRL-Q.

   If output has been stopped with CTRL-S, this will restart it. (Note that some systems will automatically issue CTRL-S if they need to pause output; this character may not have been typed from the keyboard.)

6. Check that the NO SCROLL key (if you have one) is not locked or toggled on.

   This key stops the screen display from scrolling upward. If your keyboard has a NO SCROLL key that can be toggled on and off by pressing it over and over, keep track of how many times you've pressed it as you try to free yourself. If it doesn't seem to help, be sure you've pressed it an even number of times; this leaves the key in the same state it was when you started.

7. Check the physical connection from the terminal to the system.

8. Type CTRL-D once at the beginning of a new line.

   Some programs (such as mail) expect text from the user. A program may be waiting for an end-of-input character from you to tell it that you've finished entering text. Typing CTRL-D may cause you to log out, so you should try this only as a last resort.

9. If you're using a window system, close (terminate) the window you're using and open a new one. See Section 2.7 in Chapter 2.

   Otherwise, turn your terminal off, wait ten seconds or so, then turn it on again. This may also log you out, but it may not; your old login session could still be running. You can check for old processes and terminate them (as explained in Chapter 7 in Section 7.2 and in Section 7.3)--although this isn't an easy thing for a beginner to do, so you might want help.

Copyright © 2003 O'Reilly & Associates. All rights reserved.