Restarting your system through the graphical interface is simple—but what if you're running a headless Ubuntu server or prefer using the command line? Whether you're on Ubuntu Desktop or Ubuntu Server, understanding how to restart Ubuntu from terminal is essential for developers, sysadmins, or anyone working with Linux remotely.

If you're new to Ubuntu, you might want to first understand what Ubuntu is and how it works before diving into terminal-based operations.

In this comprehensive guide, we'll cover everything you need to know about rebooting Ubuntu from the terminal, including different command options, use cases, and troubleshooting tips. You’ll also learn how to restart Ubuntu server from terminal, how to reboot using command line tools, and more.

Restart Ubuntu from terminal using the sudo reboot command on a remote Linux server

Why Restarting Ubuntu from the Terminal Matters

Many Ubuntu users—especially those managing servers—don't have a graphical interface. In such cases, knowing how to restart Ubuntu from terminal is a must. You may need to restart:

  • After installing updates

  • When applying configuration changes

  • After restarting network services

  • When troubleshooting

The terminal gives you full control over the reboot process, ensuring your system restarts cleanly and securely.

Many of these actions—like applying updates—are part of regular system maintenance. If you're not familiar with updating systems, check out this guide on how to update Linux safely

Quick Commands to Restart Ubuntu 

If you just need a fast way to restart Ubuntu from the terminal, the commands below cover the most common scenarios. You can copy and paste them directly based on your use case.

# Immediate restart
sudo reboot

# Restart using shutdown command
sudo shutdown -r now

# Restart with a 10-minute delay
sudo shutdown -r +10

# Restart using systemctl (systemd-based systems)
sudo systemctl reboot

# Restart a remote server via SSH
ssh user@server-ip "sudo reboot"

These commands work on both Ubuntu Desktop and Ubuntu Server, whether you're working locally or over SSH.

Prerequisites and Permissions for Restarting Ubuntu from Terminal

Before you restart Ubuntu from the terminal—especially on a remote server—it’s important to make sure you have the required permissions and access. Missing any of these can prevent the reboot command from working or even disconnect you unexpectedly.

Here’s what you should check before proceeding:

1. Sudo or Root Access

Most reboot commands require administrative privileges. If you're using a regular user account, make sure it has sudo access:

sudo reboot

Without sudo or root permissions, the system will deny the restart request.

If your user does not have sudo privileges, you can follow this guide to add a user to sudoers on Ubuntu.

2. SSH Access (For Remote Servers)

If you're managing a headless Ubuntu server, you’ll typically connect via SSH:

ssh user@server-ip

Ensure:

  • SSH service is running
  • Port 22 (or custom SSH port) is open
  • Your IP is not blocked by firewall rules

If SSH is not set up yet, follow this tutorial on installing and enabling SSH on Ubuntu.

3. SSH Key or Password Authentication

Make sure you can authenticate successfully:

  • SSH key is properly configured (~/.ssh/authorized_keys)
  • Or you have the correct password

4. Active User Sessions Awareness

If other users are logged into the system, restarting may interrupt their work. Consider notifying them or scheduling a delayed reboot:

sudo shutdown -r +10 "System will reboot in 10 minutes"

5. Firewall and Access Rules

Ensure your firewall (UFW, iptables, or cloud security groups) allows SSH access after reboot. Otherwise, you might lose remote connectivity.

How to Restart Ubuntu from Terminal (Basic Command)

The most straightforward method for how to restart Ubuntu From terminal is to use the reboot command:

sudo reboot

This command immediately initiates a system reboot. The use of sudo is necessary because restarting the system requires administrative privileges.

If you're just getting started with terminal commands, this list of basic Ubuntu commands can help you understand how these commands work.

Alternative:

sudo shutdown -r now

This command also reboots the system but adds more flexibility, allowing you to set a delay or send a message to users. Both methods are perfect if you're wondering how to restart Ubuntu by terminal.

 

Expected Terminal Output Examples

When running reboot-related commands in Ubuntu, you may notice that some commands produce little to no output. This is normal behavior. Below are examples of what you can expect when executing common restart and shell commands.

reboot Command

The reboot command typically does not display detailed output. After running the command, the system begins shutting down services and restarting.

$ sudo reboot
Connection to server closed by remote host.
Connection to server-ip closed.

If you're connected via SSH, your session will disconnect immediately.

systemctl reboot Command

This command also produces minimal output because systemd handles the reboot process in the background.

$ sudo systemctl reboot

The system will begin a controlled shutdown and restart sequence.

You can also manage system states using systemd targets. For example, rebooting is handled through systemd's reboot.target, which ensures all services are stopped in the correct order.

shutdown -r Command

When using the shutdown command, the system usually broadcasts a message to all logged-in users before rebooting.

$ sudo shutdown -r now
Broadcast message from root@server (pts/0) (Tue 12:00):

The system is going down for reboot NOW!

If scheduled, it will show a delay message instead.

exec bash Command

The exec bash command replaces the current shell session with a new one. It does not produce visible output but resets the shell environment.

$ exec bash

You may notice environment variables reloading, but no explicit confirmation message is shown.

Understanding these outputs helps you confirm whether a command has executed correctly, especially when working remotely.

reboot vs shutdown -r vs systemctl reboot

While all three commands can restart Ubuntu from the terminal, they behave slightly differently under the hood. Understanding these differences helps you choose the right command based on your situation—especially on production servers.

reboot 

The reboot command is the simplest and fastest way to restart your system. It immediately triggers a reboot without additional options.

  • Best for quick, manual restarts
  • Minimal control or customization
  • Commonly used for everyday tasks
sudo reboot

shutdown -r Command

The shutdown -r command provides more flexibility. You can schedule a restart or send a notification message to logged-in users before rebooting.

  • Allows delayed or scheduled restarts
  • Can notify users before reboot
  • Ideal for shared systems or production environments
sudo shutdown -r now

systemctl reboot Command

The systemctl reboot command uses systemd, the modern init system in Ubuntu. It ensures all services are properly stopped before rebooting.

  • Recommended for systemd-based systems (Ubuntu 16.04+)
  • More controlled and graceful restart process
  • Better for managing services and dependencies
sudo systemctl reboot

Which Command Should You Use?

For most users, sudo reboot is enough. However, if you need more control—such as scheduling or ensuring a clean service shutdown—shutdown -r or systemctl reboot are better choices.

Comparison of reboot, shutdown -r, and systemctl reboot commands in Ubuntu

How to Restart an Ubuntu Server from Terminal?

If you're working on a remote server (often without GUI), you'll likely SSH into your machine and want to know how to restart Ubuntu server from terminal.

Managing a remote server? Choosing the right hosting environment like a Ubuntu VPS server ensures better performance and reliability when handling reboots.

Steps:

1. SSH into the server:

ssh user@your-server-ip

For secure access, it's recommended to use SSH key authentication instead of passwords and disable root login for better security.

2. Use the reboot command:

sudo reboot

You can also use:

sudo systemctl reboot

This command works similarly but uses systemd under the hood, the modern init system used by Ubuntu.

🔗 Want to reboot Linux systems more generally? Check out our guide on How to reboot Linux

Steps to restart an Ubuntu server from terminal over SSH

Restarting Ubuntu 20.04 from Terminal

Wondering how to restart Ubuntu 20.04 from terminal specifically? The reboot process hasn’t changed much between versions, so everything we've covered so far applies to Ubuntu 20.04.

For example:

sudo reboot

or

sudo shutdown -r now

are perfectly valid.

However, if you’re running a newer version like Ubuntu 22.04 or managing services with systemd, you can also use:

sudo systemctl reboot

This method ensures compatibility with systemd-managed processes.

 

How to Schedule a Restart or Send a Warning Message

Need to notify users before rebooting or schedule a reboot? Use the shutdown command with additional arguments:

sudo shutdown -r +10 "System will reboot in 10 minutes"

This will restart the system after 10 minutes and display the message to all logged-in users.

To cancel a scheduled shutdown or restart:

sudo shutdown -c

 

How to Reboot Remote Ubuntu Servers Safely

When restarting an Ubuntu server remotely via SSH, you need to be careful to avoid losing access or interrupting critical processes. A careless reboot can disconnect your session or affect other users and running services.

In real-world scenarios, many administrators experience SSH disconnections during reboot if sessions are not handled properly. Using tools like tmux has proven to significantly reduce the risk of losing access during critical operations.

Here are best practices to safely reboot a remote Ubuntu server:

Use tmux or screen 

If you're running long processes or managing important tasks, use tmux or screen to keep your session alive even if the SSH connection drops.

# Start a tmux session
tmux

# Or start a screen session
screen

This ensures your processes continue running even if you disconnect before the reboot completes.

Tools like tmux allow you to detach and reattach sessions, which is especially useful when managing long-running processes during a reboot.

On production servers running services like web servers, it’s important to manage processes properly. For example, if you're running Nginx, see how Nginx is installed and managed on Ubuntu.

Run Background Tasks with nohup

If you need a process to continue running independently of your session, use nohup:

nohup your-command &

This prevents the process from being terminated when your SSH session ends.

If you're running containers (e.g., Docker), keep in mind that a system reboot will stop all containers unless they are configured with restart policies.

Notify Logged-in Users Before Reboot

On shared servers, it’s important to inform users before restarting the system. You can send a message and delay the reboot:

sudo shutdown -r +5 "Server will reboot in 5 minutes. Please save your work."

This gives users time to prepare and prevents unexpected disruptions.

Check Active Sessions Before Restart

Before rebooting, see who is currently logged in:

who

This helps you decide whether to delay the reboot or notify specific users.

Ensure SSH Access After Reboot

Before restarting, confirm that:

  • SSH service is enabled (systemctl status ssh)
  • Firewall rules allow SSH connections
  • Your server will come back online properly after reboot

Taking these precautions ensures a smooth and safe reboot process, especially for production environments.

Checklist for safely rebooting a remote Ubuntu server without losing SSH access

Security and Best Practices for Restarting Ubuntu

Restarting Ubuntu from the terminal is simple, but doing it safely—especially on production systems—requires following best practices. A poorly timed or unmanaged reboot can lead to downtime, data loss, or service disruption.

Here are key security and operational best practices to follow:

Schedule Reboots During Maintenance Windows

Always plan system restarts during low-traffic periods or defined maintenance windows. This minimizes the impact on users and services.

  • Avoid peak usage hours
  • Coordinate with your team if working in production environments

In most production environments, scheduled reboots during maintenance windows are standard practice to avoid service disruption.

Use Scheduled Reboot Commands

Instead of restarting immediately, consider scheduling the reboot to give users time to prepare:

sudo shutdown -r +15 "Scheduled maintenance reboot in 15 minutes"

This approach ensures a smoother and more controlled restart process.

For more advanced automation, you can also use cron jobs. Learn how in this guide on creating cron jobs in Ubuntu.

Always Back Up Critical Data

Before restarting—especially after updates or configuration changes—make sure you have a recent backup of your system or important data.

  • Use snapshot tools or backup services
  • Verify backup integrity before major changes

Close or Save Running Processes

Ensure that important applications and services are properly stopped or saved before rebooting:

  • Save open files and sessions
  • Stop critical services gracefully if needed

Monitor System After Reboot

After restarting Ubuntu, check that all services are running correctly:

systemctl status

You can also review logs for potential issues:

journalctl -xb

Following these best practices helps ensure your Ubuntu system remains stable, secure, and reliable after every reboot.

Troubleshooting Ubuntu Reboot Problems

Sometimes, restarting Ubuntu doesn’t go as expected. The system may hang, fail to boot properly, or encounter service errors. In these cases, knowing how to troubleshoot reboot issues from the terminal can save you time and prevent downtime.

In practice, unexpected reboots are often caused by failed services or memory issues. Reviewing logs with journalctl is one of the most reliable ways to diagnose these problems quickly.

Here are the most common reboot problems and how to fix them:

System Stuck During Reboot

If Ubuntu gets stuck while rebooting, it’s often due to a process that fails to stop properly.

  • Wait a few minutes to ensure it’s not just a delay
  • Try switching to another TTY using Ctrl + Alt + F3
  • Force reboot if necessary:
sudo reboot -f

Note: Forced reboot should be used only as a last resort, as it may cause data loss.

Boot Issues and GRUB Problems

If the system fails to boot after restarting, the issue may be related to GRUB (the bootloader).

  • Access the GRUB menu during startup (hold Shift or press Esc)
  • Select Advanced options for Ubuntu
  • Boot into Recovery Mode

From recovery mode, you can repair broken packages or fix boot issues.

If your system fails due to package issues, you can fix it using this guide on fixing broken packages in Ubuntu.

Failed Systemd Units

Sometimes, services fail during reboot due to misconfiguration or dependency issues. You can check failed units with:

systemctl --failed

Then inspect a specific service:

systemctl status service-name

Check Logs with journalctl

System logs are the best place to identify reboot problems. Use journalctl to analyze what went wrong during the last boot:

# View logs from the current boot
journalctl -xb

# View logs from the previous boot
journalctl -xb -1

Look for error messages, failed services, or warnings that occurred during shutdown or startup.

Kernel Panic or Critical Errors

If you encounter a kernel panic or serious error during reboot, try booting into an older kernel version from the GRUB menu. This can help you regain access and fix the issue safely.

Understanding these troubleshooting steps can help you quickly recover from reboot failures and keep your Ubuntu system stable.

How to Cancel a Scheduled Reboot?

If you’ve scheduled a reboot using the shutdown -r command but need to stop it, you can easily cancel the pending restart before it happens.

To cancel a scheduled reboot, use the following command:

sudo shutdown -c

This command immediately cancels any scheduled shutdown or reboot operation. If a message was previously broadcast to users, the system may notify them that the reboot has been canceled.

How It Works

  • Stops any active shutdown or reboot timer
  • Works only if the reboot was scheduled (e.g., shutdown -r +10)
  • Has no effect if no reboot is currently scheduled

It’s a simple but essential command when managing servers, especially if plans change or a reboot is no longer necessary.

Restarting Ubuntu clears system memory (RAM), which can temporarily resolve performance issues caused by memory leaks or stuck processes.

Command Reference Table for Restarting Ubuntu

The table below summarizes the most commonly used Ubuntu reboot commands, their behavior, and what you can expect when running them. This quick reference helps you choose the right command based on your needs.

Command Behavior Expected Output / Exit Code
sudo reboot Immediately restarts the system No output; system begins reboot process (exit code 0 on success)
sudo shutdown -r now Restarts system instantly using shutdown command Broadcast message to users, then reboot (exit code 0)
sudo shutdown -r +10 Schedules reboot after 10 minutes Displays scheduled reboot message (exit code 0)
sudo systemctl reboot Reboots system via systemd with graceful service handling No direct output; systemd manages shutdown (exit code 0)
sudo reboot -f Forces immediate reboot without graceful shutdown No output; may risk data loss (use with caution)
ssh user@server-ip "sudo reboot" Reboots remote server via SSH SSH session disconnects immediately after command

This reference table is especially useful when working across different environments, helping you quickly identify the safest and most appropriate reboot method.

How to Restart Terminal Linux

If you're looking to restart the terminal session itself (not the entire system), you can simply close and reopen the terminal window or use the following command to reinitialize the shell:

exec bash

This replaces the current shell with a new instance. It’s helpful when testing environment variable changes.

Restart Ubuntu Desktop from Terminal

If your GUI is unresponsive or you just prefer the command line, here’s how to restart Ubuntu desktop:

sudo systemctl restart gdm

If you’re using a different desktop environment:

For KDE:

sudo systemctl restart sddm

For LightDM (common on older Ubuntu):

sudo systemctl restart lightdm

These commands restart the display manager without rebooting the entire system.

Restarting the display manager (GDM, SDDM, or LightDM) is useful when troubleshooting GUI issues without affecting system uptime.

Cloud & VPS Reboot Tips (AWS, DigitalOcean & More)

 

When rebooting Ubuntu on cloud platforms or VPS environments, there are a few additional considerations compared to local machines. Cloud providers add layers like virtual networking, monitoring systems, and control panels that can affect how a reboot behaves.

Cloud providers may handle reboots differently, such as soft reboot (OS-level) vs hard reboot (power cycle), which can affect running services.

Here are some important tips to keep in mind:

Provider Control Panels

If your server becomes unresponsive after a reboot, most cloud providers offer a web-based console or reboot option from their dashboard. This is useful if SSH access fails.

  • Use web console access for emergency recovery
  • Perform hard reboot from the control panel if needed

Network and Firewall Checks

After rebooting, ensure your network configuration and firewall rules are correctly applied. Misconfigured settings can block SSH access.

  • Verify SSH port accessibility
  • Check UFW or iptables rules
  • Confirm cloud security group settings

Ephemeral Storage Risks

Some cloud instances use temporary (ephemeral) storage that may be reset after reboot or stop/start cycles. Always store important data on persistent volumes.

Monitoring After Reboot

Use your provider’s monitoring tools to track server health and uptime after reboot. This helps ensure the system comes back online correctly.

Choosing a Reliable VPS Provider

Server stability and reboot reliability heavily depend on your hosting provider. Using a scalable solution like a Cloud VPS ensures better performance, flexible resources, and consistent uptime during system restarts.

If you're deploying applications or managing production environments, using a high-performance Linux VPS ensures faster reboot times, stable networking, and better control over your server. At 1Gbits, we manage high-performance Linux servers daily, which allows us to apply real-world best practices for safe and efficient system reboots.

By understanding these cloud-specific considerations, you can safely restart Ubuntu servers in any VPS or cloud environment with confidence.

Command Reference Table

Command Use Case Behavior Best For
sudo reboot Immediate restart Quick reboot without delay Personal use / quick fixes
shutdown -r now Controlled restart Sends broadcast message Shared systems
shutdown -r +10 Scheduled reboot Delayed restart with notice Production servers
systemctl reboot Systemd-based restart Graceful service handling Modern Ubuntu systems
reboot -f Force reboot Immediate without cleanup Emergency situations

How to Restart Ubuntu From Terminal Mac

If you're remotely managing an Ubuntu server from a Mac, you’d typically use SSH from the macOS Terminal:

ssh user@server-ip

Once logged in, use:

sudo reboot

The same principles of how to restart Ubuntu using terminal apply—only your client (macOS) differs.

 

Ubuntu Shutdown Command Timer

Need to reboot or shut down the system at a specific time?

Example:

sudo shutdown -r 02:30

This schedules a reboot at 2:30 AM.

Learn more with our guide: Linux Shutdown Command

 

How to Restore Ubuntu from Backup

Restarting isn’t always enough. If your system is broken, you may want to restore Ubuntu from backup. You can do this with:

  • Timeshift (for snapshots)

  • Clonezilla (for full disk images)

  • Deja Dup (Ubuntu’s built-in backup tool)

These tools help you roll back to a stable state. Just remember to always back up before critical changes.

Before performing major changes, it’s also useful to understand your system version. Here’s how to check your Ubuntu version.

How to Reset Ubuntu from BIOS

Resetting Ubuntu from BIOS directly isn't possible, but you can boot into recovery mode or from a live USB to reset or reinstall Ubuntu. From BIOS:

  1. Set your boot device to USB/DVD

  2. Use a live Ubuntu ISO to reinstall the OS or fix boot issues

Bonus: Need to Restart Apache Instead?

If your goal is to restart Apache services in Ubuntu or another Linux distro, check out our article on How to restart Apache in Linux, CentOS and Debian

Ubuntu BIOS and boot troubleshooting for recovery mode or USB boot

Conclusion: Restart Ubuntu with Ease and Efficiency

Restarting Ubuntu from the terminal is a fundamental task that every Linux user should master—whether you're managing a personal desktop or a remote server. With the various methods we've covered—from the simple reboot and shutdown commands to server-specific approaches and command line alternatives—you can now confidently reboot your Ubuntu system in any scenario. Whether you’re running Ubuntu 20.04, managing a Linux VPS, or trying to reset the terminal itself, using the terminal gives you full control and flexibility.

Want reliable performance and fast reboots? Check out our Linux VPS plans designed for speed, security, and simplicity.

Further Reading & Official Documentation

If you want to dive deeper into how Ubuntu handles reboots and system management, the following official resources and guides can help you better understand the underlying processes and commands.

Reviewing official documentation can give you a deeper understanding of how reboot commands work under the hood and help you troubleshoot advanced issues more effectively.