Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Recently my main computer freezes up more often, and instead of giving him the hard treatment by pushing the power button, I'd rather reboot him gently.

So I grab my laptop, fire up Terminal and login to my main computer.

ssh username@ip-address  

I enter my password and that’s how far I come every time. I know that I can kill single processes, but when I try the reboot or restart command, my laptop reboots, not the main computer which I logged into via ssh.

I think it is possible, so this goes out to the advanced terminal user (I'm a beginner).

share|improve this question
up vote 23 down vote accepted

Once you've logged in via ssh then you need to use shutdown with the -r flag (for restart):

$ ssh username@ip-address
$ sudo /sbin/shutdown -r now

Or, to do it all in one command:

$ ssh username@ip-address sudo /sbin/shutdown -r now
share|improve this answer
you can also type it all in one line "ssh user@host sudo /sbin/shutdown -r now" – Leonardo Constantino Mar 17 '11 at 19:14
Thank you guys - works flawless and saves me some time. Luckily my computer hasn't had any freezes lately. – pattulus Mar 19 '11 at 20:29

Your Answer


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.