Open Source Software Shortcut -- Escaping SSH With '~'
More open source software
One thing you may not know about SSH is that it has an escape character: ~. To try it out, hit return (the escape character is only picked up at he start of a line, so you must make sure you are) at the console in an active SSH session, then enter ~. Nothing will show on screen; so far so good. Next, hit Ctrl-Z and the session will be suspended -- handy if you want to check something on your local box without logging all the way out of SSH. This trick will also work from within screen, and even from within mutt. To return to your SSH session, type fg and hit return.SSH's escape character may be one of its best kept secrets. Using '~' can suspend a session as well as a host of other escape sequences. Learn how to get the most out of these open source software shortcuts.
This isn't the only use for ~. For a full list of escape sequences, type ~?. This one doesn't work within mutt; however, only from a console, although screen is fine.
Another potentially useful escape sequence option is ~C, which gives you an SSH command line. Type ? here to see the available commands; this way you can set up forwards without having to restart your SSH session. If you do set any up, you can get a list of them with ~#.
~. will close the connection and any associated sessions. This is useful if the network connection drops out; you can close the SSH session immediately, rather than waiting for it to time out (and without closing your local console window).
Finally, if you want, you can change the escape character with the -e option on the command line. To change it to %:
SSH -e % email@example.com
Juliet Kemp has been messing around with Linux systems, for financial reward and otherwise, for about a decade. She is also the author of "Linux System Administration Recipes: A Problem-Solution Approach" (Apress, 2009).