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.
A session can be hung for several reasons. One of the most common is that the connection between your terminal and the computer gets too busy and your terminal has to wait its turn. (Other users or computers are probably sharing the same connection.) In that case, your session will start 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 (and how long that is depends on your individual situation; ask your system administrator for advice), the following solutions will usually work. Try these in the order shown until the system responds.
Press the RETURN key.
You may have typed a command but forgotten to press RETURN to tell the shell that you’re done typing and it should now interpret the command.
If you can type commands, but nothing happens when you press RETURN, try pressing LINE FEED or typing CTRL-J. If this works, your terminal needs to be reset 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.
If your shell has job control (see Chapter 6), 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.
Use your interrupt key (found earlier in this chapter—typically DELETE or CTRL-C.
This interrupts a program that may be running. (Unless a program is run in the background, as described in Chapter 6, the shell will wait 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.
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.)
Check that the NO SCROLL key 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.
Check the physical connection from the terminal to the system.
Type CTRL-D at the beginning of a new line.
Some programs (like 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.
If you’re using a window system, close (terminate) the window you’re using and open a new one. Otherwise, turn your terminal off, wait ten seconds or so, then turn it on again (this may also log you out).
If none of these works, you should then ask a local system expert for help and watch carefully.
Get Learning the UNIX Operating System, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.