It’s a very basic post, yet still useful!
Sometimes when you disconnect from a network or VPN or have any network connectivity problem in general that affects an established SSH connection to any of your servers, the terminal hangs for quite a while and you most probably just close the terminal and open a new one!
To avoid this, just do the following:
- Press Enter
- Press Shift + ~
- Press .
And the session is terminated without having to close the terminal window, that’s it!
Source: A comment on one of the StackOverflow posts that I can’t find right now!