How to do exit an ssh connection?
Problem:
I need to exit from an ssh connectio but is unresponsive (type and do nothing!).
Solution:
To exit, you have to type a keys combination into the ssh connection.
Step by step:
There are two ways:
-
Normal way. Closing the shell session will usually exit, for example: with the shell builtin command,
exit
, followed byEnter
, orCtrl+d
, (end-of-file). -
Hit
Enter~.
Hit theEnter
key, hold it, then type~.
and ssh should immediately close and return you to your command prompt. This way is used in the case where you have a bad connection and the shell is unresponsive (or due to inactivity),
Note:
-
In Ubuntu using windows keyboards
~
is get by pressingAlt+ñ
(spanish layout). -
In MacOS on U.S. International - PC layout, press
Alt+N
and thenSpace
. -
In Ubuntu, hold down together:
Alt Gr
+4
. -
In Ubuntu, hold down together:
Ctrl
+Shift
+u
then a underlined u letter should appear. Release keys. Enter7E
(Unicode for ~), pressspace
orEnter
.
Source:
https://superuser.com/questions/467398/how-do-i-exit-an-ssh-connection