SSHidden gems
SSH client feels like a simple beast. You invoke it, you pass it the hostname… and that’s it. At most, you supply -L command-line switch for TCP connection forwarding, or -X for X11 forwarding, and earn some brownie points. Sure, the man page lists a few other options, but why should you care?
Recall the last time you spun off the ssh just to remember you forgot to add -L . You can just terminate the session and respawn it again. However, ssh provides a better way: the menu. Just type Enter then ~ during your interactive session. Nothing would change visually, but the next key you type will have a special effect.
For an overview, press ? You’ll see that the dot terminates current session which comes handy when it becomes unresponsive and Ctrl-C doesn’t help. Note that you’ll need to type all three keys: Enter, ~, and .. V increases verbosity, # lists forwarded connections. But perhaps most importantly, C opens the command line. Type help to list available commands. From here, you can create and terminate port forwardings, including dynamic ones. The latter effectively creates a SOCKS proxy which works over the SSH channel. The only inconvenience is that help command closes the menu, so you need to type Enter, ~ and C to start over.
Isn’t it amazing how many tricks are stuffed into a small executable ssh ?