How to Reboot an Ubuntu Server from the Terminal

Unlike personal desktop computers which are frequently turned on and off, Linux servers are designed to run continuously for months or even years without interruption. However, there are specific situations where a full system reboot is absolutely necessary, such as applying a critical kernel update, installing new hardware drivers, or recovering from a severe system crash that cannot be resolved by restarting individual services.

When managing an Ubuntu server remotely via an SSH terminal, you cannot simply click a graphical “Restart” button. Instead, you must issue a precise command to tell the Linux kernel to safely shut down all running processes and reboot the machine.

The Standard Reboot Command

The most direct and commonly used method to restart a modern Ubuntu server is the dedicated reboot command.

  1. Ensure you are logged into your terminal.
  2. Because rebooting a server affects all users and services, it requires administrator privileges. Type the following command and press Enter:
sudo reboot
  1. Provide your sudo password when prompted.

The command executes immediately. Your SSH connection will instantly drop with a “Connection closed by remote host” message as the server cuts network access and begins its shutdown sequence. Depending on the server’s hardware, it will typically be back online and ready for a new SSH connection within 30 to 60 seconds.

How to Schedule a Delayed Reboot

If you are managing a production server with active users, executing an immediate reboot will disrupt their work without warning. It is best practice to schedule the reboot for a few minutes in the future, giving the system time to broadcast a warning message to any other administrators currently logged in.

To do this, use the shutdown command with the -r (restart) flag.

  1. To reboot the server in exactly 5 minutes, run:
sudo shutdown -r +5

The terminal will confirm the scheduled time and immediately broadcast a message to all active terminal sessions warning them that the system is going down.

  1. To schedule a reboot for a specific time (e.g., 2:30 AM during low traffic hours), use the 24-hour time format:
sudo shutdown -r 02:30

How to Cancel a Scheduled Reboot

If you scheduled a reboot but suddenly realise you made a mistake (perhaps a long database backup is still running), you can easily cancel the pending shutdown timer.

  1. Run the shutdown command with the -c (cancel) flag:
sudo shutdown -c

The timer will be aborted, and the server will remain online.

The Emergency Force Reboot

If the server is completely unresponsive, refusing to close applications, and ignoring the standard sudo reboot command, you can force the kernel to restart immediately without waiting for graceful shutdowns.

Warning: This is the digital equivalent of ripping the power cord out of the wall and can lead to data corruption. Use this only as an absolute last resort.

sudo reboot -f

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.