Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I'm connection to a remote server via ssh inside a Terminal window, and I put the computer to sleep, when I come back the connection is of course interrupted. The problem is there seems to be no way to resurrect the window and its associated local bash prompt. All I really care about is re-using the Terminal window. I don't want to have to do command+N which opens a tiny window, and have to resize it, and position it on the screen, etc. Shouldn't there be some way to use the same window and local shell? I would kind of expect a sleep action to cause the ssh program to drop back to a local bash prompt, so I don't understand why the window seems to be completely dead.

share|improve this question
See also… for a number of solutions and workarounds. – tripleee Oct 19 '15 at 4:12
up vote 6 down vote accepted

Press Enter ~ . to terminate a SSH session.

(~ is ssh's escape character, and it only works after a new-line.)

share|improve this answer
+1 for some really useful info. – Eddified Oct 6 '10 at 5:06

What happens if you use Ctrl-C? The other option would be to create a new tab, rather than a new window by using Command-T instead of Command-N. And another option on top of that would be to open a new tab, use the killall command to force SSH to end, and then close the new tab.

share|improve this answer
killall ssh is my usual fix for this. – Doug Harris Oct 5 '10 at 18:34
ctrl+c didn't fix it. Or maybe it did, but took awhile. In any case, it appears killing it does the trick. – Eddified Oct 6 '10 at 5:08

wait a few minutes and you'll get the prompt back. If you don't want to wait, you can copy and paste the screen to a text file, open a new terminal tab/window and cat the file. (You'll lose the colours though)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.