I have a SSH session with a VM running on Amazon AWS.

One of the programs I had run hung up and froze the SSH terminal.

So I hit Enter+~+.

Now when I am trying to connect to my machine it says connection timed out.

  1. Does this mean that connection was only terminated from the client side and is still active on server? If so how do I create a new connection?
  2. Ctrl+C does not work on a SSH shell. Does this mean it is not possible to terminate the hung up command without terminating the SSH session?

2 Answers 2


You can send a SIGSTOP to the process (most shells use Ctrl-Z for this), which will tell the present process pause it's current state. This should then return you to your shell command prompt. You can then see what jobs are paused with the jobs command and then kill the process with the kill command. If the process is number 1 in the list of the output of jobs then you would issue kill -TERM %1 (and check it has gone with jobs once more). You may have to send a SIGKILL instead (kill -KILL %1).

A simple guide to job control can be found at:


  • What happens if I force terminate a SSH session. Does it remain open on the server? For how long? Commented Aug 7, 2013 at 9:43
  • A similar question to that was asked on SuperUser: superuser.com/questions/143925/…
    – Drav Sloan
    Commented Aug 7, 2013 at 9:48
  • How do I resume a job after pausing it? Commented Aug 7, 2013 at 9:51
  • You use the fg command (which defaults to %1, or you can specify the process number - as listed in jobs - as a argument). You can also tell the process to resume "in the background" (as though you issued the command with the & operative) with the bg command.
    – Drav Sloan
    Commented Aug 7, 2013 at 10:05

When you terminate a connection with ~., the server may not notice it immediately. Eventually it will send a keepalive message (“hey client, I haven't heard from you in a while, are you still there?”), detect no answer, and close the terminal, sending a SIGHUP to the foreground process group leader.

Ctrl+C works via SSH just as well as without SSH.

Having a process crash would not prevent you from opening a new connection.

From the symptoms you describe, it's the whole VM that's gone offline for some reason. Maybe the OS crashed, maybe its network configuration is hosed, maybe some firewall is blocking you, maybe Amazon terminated your account and your VM… All you can tell is that right now, your VM is unreachable. Check the administration console for any clues. If it looks like your VM should be running but it isn't, contact Amazon support.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .