0

I am aware I can type exit, logout, or hit Ctrl-D to logout normally. None of this works when the server is timed out, but thankfully I can do Enter-~-. to exit the session.

However, this takes me all the way back to my local session and exits all jumps as well. How do I just exit the current ssh session and not previous jumps?

Mario
  • 3

1 Answers1

1

Press ~ twice to send a single literal ~ to the remote session.

So if you are three sessions deep, then ~~~. would exit out of the 3rd level 'ssh' (i.e. it makes the 1st ssh client send a ~~. to the second, and from there it becomes ~. to the third).

Alternatively: Use ssh -e ... to specify a different escape character for each level, which wouldn't be interpreted by the other levels.

grawity
  • 501,077