fooyeahcode

Link

Mike The Coder: How to kill a dead SSH session gracefully

mikethecoder:

I have a bad habit of leaving an open SSH session sitting there and then coming back to it to realize that it’s dead. In the past, I’ve just killed the terminal to end it. Here’s a better way:

<Enter>~.

That’s the enter key followed by the tilda character followed by a period.

To explain, SSH has a few different escape sequences. To see them, run~? while in an open SSH session. Here they are:

mcrittenden@freshbox$ ~?
Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)

As you can see, ~. is the escape sequence to terminate the connection, and the note at the end says that they’re only recognized immediately following a newline, hence <Enter>~.

the next magic spell :) 

via umurgedik
Posted on Wednesday, August 31 2011. Tagged with: Bashsshmagic
16
Notes
  1. miscarriage8it liked this
  2. lerasplace liked this
  3. thebutterfliesaresmiling liked this
  4. caliens liked this
  5. jamescooke reblogged this from fooyeahcode
  6. thatgirlispoison liked this
  7. simplyexpressingmyself liked this
  8. fooyeahcode reblogged this from umurgedik and added:
    the next magic spell :)
  9. umurgedik reblogged this from mikethecoder
  10. cincodenada liked this
  11. mikethecoder posted this
fooyeahcode

When I am programming, I am at a nexus. My thoughts become concrete. My ideas transform illusion into reality. The structure of existence is remade before my very eyes. I become a vessel for the creative force of the universe. I am carried aloft as if on the wings of dragons. Why should I care if nobody knows my name?

The Hacker Ethic
Ask me anything Submit
Previous Next