home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

Unix Power ToolsUnix Power ToolsSearch this book

5.6. Checklist: Terminal Hangs When I Log In

If your terminal seems to "hang" (freeze, lock up) when you log in, here are some things to try:

Here are a few more tips for dealing with stuck terminals.

5.6.4. Stalled Data Connection?

Be sure that the wires haven't come loose.

If you're using a modem and the modem has function lights, try pressing keys to see if the Send Data (SD) light flashes. If it does, your terminal is sending data to the host computer. If the Receive Data (RD) light flashes, the computer is sending data to your terminal. If you don't see anything, there might be something wrong on your terminal.

If you're connected with rlogin or telnet or ssh (Section 1.21), the network to the remote computer might be down or really slow. Try opening another connection to the same remote host -- if you get a response like Connection timed out, you have two choices:

  1. Wait for your original connection to unfreeze. The connection may come back and let you keep working where you left off. Or the connection may end when rlogin, telnet, or ssh notices the network problem.

  2. Quit the session, and try again later.

5.6.5. Aborting Programs

To abort a program, most users press CTRL-c. Your account may be set up to use a different interrupt character, such as DELETE. If this doesn't work, try CTRL-\ (CTRL-backslash). Under most circumstances, this will force the program to terminate. Otherwise, do the following:

  1. Log in at another terminal or window.

  2. Enter the command ps x, or, if that doesn't work, use ps -u yourname, where yourname is your Unix username. This displays a list of the programs you are running, something like this:

    % ps x
    PID     TTY     STAT    TIME    COMMAND
    163     i26     I       0:41    -csh (csh)
    8532    i26     TW      2:17    vi ts.ms
    22202   i26     S       12:50   vi UNIXintro.ms
    8963    pb      R       0:00    ps -x
    24077   pb      S       0:05    -bin/csh (csh)
  3. Search through this list to find the command that has backfired. Note the process identification (PID) number for this command.

  4. Enter the command kill PID (Section 24.12), where PID is the identification number from the previous step. If that doesn't work, try kill -1 PID to send a HUP signal. You can also try various other signals, including -2 or -15. If none of them work, you may need kill -9, but try the other kills first.

  5. If the Unix shell prompt (such as % or $) has appeared at your original terminal, things are probably back to normal. You may still have to take the terminal out of a strange mode though.

    If the shell prompt hasn't come back, find the shell associated with your terminal (identified by a tty number), and kill it. The command name for the C shell is csh. For the Bourne shell, it is sh. In most cases, this will destroy any other commands running from your terminal. Be sure to kill the shell on your own terminal, not the terminal you borrowed to enter these commands. The tty you borrowed is the one running ps; look at the previous example and check the TTY column. In this case, the borrowed terminal is TTY pb.

    Check ps to ensure that your shell has died. If it is still there, take more drastic action with the command kill -9PID.

  6. Run ps x or ps -u yourname again to be sure that all processes on the other tty have died. (In some cases, processes will remain.) If there are still processes on the other tty, kill them.

  7. At this point, you should be able to log in again from your own terminal.

The ps (Section 24.5) command, which lists some or all of the programs you are running, also gives you useful information about the status of each program and the amount of CPU time it has consumed.

--JP and SJC

Library Navigation Links

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