Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

4 Answers

up vote 8 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
add comment

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

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

Use the "exit" command.

Note:

$ ssh -V

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

share|improve this answer
add comment

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.