I use SSH to manage a server on my local network.

ssh username@

Which works great. When I am finished in the server I normally just X out the command line window which fires a prompt telling me a process is running and closing will kill it. Which is fine.

I would however prefer a command I can use to gracefully close the ssh connect and bring the command line back to my local machine.

Is there such a thing? Or is X-ing out of the window the only way?


Close the remote shell by running:


Or press Ctrl+D.

  • haha...exit. I should have thought of that. None the less I hope this helps someone else in the future. – ryandlf May 18 '13 at 15:48
  • Actually its : exit (to close the ssh session) and: exit (to close the running local terminal) :-) – hmayag May 18 '13 at 21:43

Check the ESCAPE CHARACTERS section of 'man ssh'. The key sequence for disconnect is enter-tilde-period.

  • I'm not sure how to use that. "~." tells me command not found. – ryandlf May 18 '13 at 15:37
  • @ryandlf press the two keys quickly – Hải Phong Mar 13 '16 at 14:33

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

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