SSH Secret Menu
A seemingly innocent tweet unveiled a little-known 'secret menu' within SSH, surprising many seasoned developers who thought they knew the tool inside and out. These escape sequences, hidden in plain sight, offer powerful control over active SSH sessions, like killing a hung connection without closing the terminal. The revelation sparked a mix of genuine surprise and wry humor among Hacker News users, highlighting the depth of ubiquitous tools.
The Lowdown
A viral tweet brought to light a set of powerful, yet often overlooked, escape sequences within the SSH client. Many long-time users were astonished to discover these capabilities, which effectively act as a 'secret menu' for managing active SSH sessions directly from the terminal.
- Escape Character (~): By default, typing a tilde (~) followed by another character triggers these special commands. If the tilde is the first character on a line, it's interpreted as an escape.
- Kill Connection (~.): The most highlighted feature is
~., which can immediately terminate a hung or unresponsive SSH connection, preventing the need to close the terminal window. - Help (~?): Users can type
~?to display a list of all available escape sequences and their functions, offering an in-session guide to these hidden controls. - Other Functions: Other sequences include suspending the SSH client (
~^Z), sending a break (~B), and getting information about the connection (~V).
This discovery illustrates that even fundamental tools like SSH can harbor hidden functionalities that remain unknown to experienced users, providing unexpected efficiency gains and quality-of-life improvements.
The Gossip
Unexpected Escapes
Many seasoned SSH users expressed genuine surprise at discovering these escape sequences, admitting they had used SSH for years without knowing about this 'secret menu.' The primary utility highlighted was the `~.` command to kill a hung SSH session, a task often previously solved by closing the terminal window, showcasing a practical benefit.
Manual's Many Mysteries
A recurring sentiment in the comments was a playful jab at the idea of a 'secret menu,' with several users pointing out that these features are, in fact, well-documented in the `man ssh` page. This sparked a discussion on how often developers overlook reading comprehensive man pages for tools they use daily, framing the 'secret' as a matter of unread documentation.
Config Conundrums and Connection Choices
The discussion branched into practical configurations, such as setting `EscapeChar` to `none` in `.ssh/config` to avoid accidental activation, weighing convenience against the loss of escape sequence functionality. Additionally, some users noted that the utility of these features, particularly for SSH tunneling, might be diminishing with the rise of modern alternatives like dev tunnels and Tailscale, pointing towards evolving networking practices.