Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I often use Ubuntu's GNOME Terminal to connect to an external server using ssh. When rebooting the server the Terminal shows this message:

# reboot

Broadcast message from root (pts/0) (Wed Sep 29 13:52:26 2010):

The system is going down for reboot NOW!
# 

And a seconds later the Terminal no longer responds to keystrokes, CTRL-c, CTRL-d, etc... The only escape seems to be closing the Terminal window from the GUI.

Does anyone know of a more elegant way to break out of ssh after a remote server reboot?

share|improve this question
up vote 10 down vote accepted

Type

~. (tilde followed by dot)

and look for 'escape characters' in the man page of ssh.

share|improve this answer
    
Works like charm. Thank you! – StackedCrooked Sep 29 '10 at 14:25

Try using shutdown instead. It allows you to specify a time before the shutdown occurs. Gives you a chance to log out of the session:

sudo /sbin/shutdown -r 60 "System is rebooting in 60 seconds!"
share|improve this answer

Use the "exit" command.

Note:

$ ssh -V

OpenSSH_5.3p1 Debian-3ubuntu7, OpenSSL 0.9.8k 25 Mar 2009

share|improve this answer

This will schedule the shutdown a moment after (~ 0 seconds) you exit the ssh session.

 sudo shutdown --reboot 0 ; exit
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .