75

How do I reboot a Ubuntu Server from the command line? sudo reboot now never seems to work for me. Because its a server, I don't have a window manager installed, so I can't do it from a GUI (which always seems to work).

enter image description here

I've had the problem for years on different versions of the operating system. It happens in virtual machines and on real metal. The same problem exists with sudo shutdown now, too.

I've lived with it in the past. The difference now is I don't want to just hit the power button because I might lose data.

  • Have you tried sudo shutdown -r now ? – ASCIIbetical Dec 30 '13 at 4:25
  • 3
    sudo reboot now is not a valid option. see man 8 reboot – souravc Dec 30 '13 at 4:31
  • Thanks souravc - that's interesting. The command never complains about an invalid option. I'll test some of these when I get out of mysql. – user207039 Dec 30 '13 at 4:45
  • 4
    sudo init 6 must always work. Also, there are Ctrl+Alt+Del and REISUB. – Danatela Dec 30 '13 at 5:46
112

Try using the following command to safely reboot:

sudo reboot

If, instead, you want to shut down the server safely, use this command:

sudo shutdown -h now
  • 1
    You did not mention "safely" in the sudo reboot method, it may mislead some users. – rap-2-h Jan 15 '18 at 8:53
  • @rap-2-h Wait, so do you mean sudo reboot is safe or not safe? – wisbucky May 3 '18 at 20:16
  • @wisbucky : sudo reboot is safe – Jay May 10 '18 at 4:05
  • had a debate with a coworker about this today. Is this method preferred over sudo poweroff? – Gansheim Jul 24 '18 at 6:10
23

For reboot, type the following

sudo shutdown -r now
3

As an alternative to sudo shutdown -r now, this command also effects an immediate shut-down:

sudo shutdown -h +0

Add the -r command to reboot:

sudo shutdown -r -h +0

Output (running as root):

root@mydevwkstn:~# shutdown -r -h +0

Broadcast message from cjbs@mydevwkstn
        (/dev/pts/10) at 14:41 ...

The system is going down for halt NOW!
root@mydevwkstn:~#
0

An alternate way:

sudo init 6

[NOTE]:

Without the init program there could be no command interpreter process.

0

If you want to reboot your system, using @Jay's solution, you'll notice that the reboot will be scheduled by one minute. If, instead, you want your system to reboot immediately, you can use the following command:

reboot -f

The -f parameter will force your reboot to happen as soon as you enter the command.

protected by Braiam Aug 17 '16 at 22:07

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?