$title = "Killing a Unix process"; $area = "Unix Support"; $metadata = "unix, commands, process, kill"; $pfloc = ""; require '/usr/local/wwwdocs/ucs/fragments/header.phtml'; require '/usr/local/wwwdocs/ucs/fragments/header-bc.phtml'; ?>
If you are logged in to a Unix system and your session "hangs" or "freezes" (i.e. nothing happens for a long time and it does not respond to Ctrl/Q Ctrl/C or Ctrl/D), you can attempt to unfreeze it yourself by "killing" the process which has stopped your session.
Login to the system where your session is frozen
Type the command:
w usid
where usid is your own username. This will produce a line of output for each login something like this:
9:53am up 82 day(s), 15:58, 132 users, load average: 6.50, 6.25, 5.70 User tty login@ idle JCPU PCPU what nabc pts/160 9:12am -csh nabc pts/166 9:53am w nabc
Note the contents of the tty column for the frozen login -- in this example attached to pts/160.
Type the command
ps -t tty
where tty is the tty designation noted above. For example
ps -t pts/160
The output will be something like
PID TTY TIME CMD 20865 pts/160 0:00 elm 18986 pts/160 0:00 csh
Note (under PID) which of your processes issued the command which is now "hung".
Type the command
kill -KILL xxxxx
where xxxxx is the process number (PID) of the frozen process. For example
kill -KILL 20865
If this does not clear the frozen process, telephone the computer operators on extension 8075.