January 1, 2008

Close your frozen ssh session

I am working with Linux quite a lot and sometimes I face this situation: I have a terminal with ssh connected to a remote server and after a while the ssh connection gets frozen on a remote side for some reasons. Now what? I used to find the PID of the ssh process in another terminal and then used kill -9 PID. This method looked a bit too "brute force" just for closing the broken ssh session and I was looking for a more "elegant" solution. Like when I am telnet_ed somewhere, I can use the CRTL+] key sequence as a escape character to break the connection. I found a similar solution for ssh: [enter]~. First press the Enter key, then tilde, and then add a dot and your ssh session will be closed and you can continue your work in back in freed terminal.