18 Aug 2025
Restarting is one of the most basic system management tasks in Linux, but many people don’t fully understand how to do it correctly. Whether you’re looking after a cloud server, using Ubuntu on your personal computer, or setting up a script to restart automatically, knowing the right way to reboot is important for keeping your system stable and protecting your data.
In this step-by-step guide, you will learn how to:
The reboot command in Linux is a built-in utility that performs a clean restart of the operating system. It’s an essential tool for administrators and users alike, commonly used in situations such as:
Syntax
reboot [OPTION]...
Reboot
Command Usagesudo reboot
This is the most common way to restart a Linux system. Running this command will trigger an immediate reboot. In most cases, you’ll need sudo privileges (administrator rights) to execute it successfully.
There are several ways to reboot a Linux system directly from the terminal. The most common methods are:
# Method 1: Using the reboot command
sudo reboot
# Method 2: Using the shutdown command
sudo shutdown -r now
# Method 3: Using systemctl (on modern Linux distributions)
sudo systemctl reboot
Each method works slightly differently and is useful in different situations:
reboot
— Quick, immediate restarts. Simple and straightforwardshutdown -r
— Scheduled or delayed reboots. Can warn users and set a specific timesystemctl reboot
— Modern Linux systems. Works with systemd
for better integrationReboot
Command OptionsThe reboot
command can be used with additional flags to change its behavior:
-f
— Forces an immediate reboot without going through the normal shutdown process--help
— Shows available options and usage information--no-wall
— Prevents sending warning messages to logged-in usersExample: Force Reboot
sudo reboot -f
⚠️ Warning: The -f
option bypasses standard shutdown procedures. This may cause:
Use this option only as a last resort, for example when the system is completely frozen and won’t respond to normal reboot commands.
shutdown
to RebootThe shutdown
command can also be used to restart your system by adding the -r
flag.
Schedule a Reboot
sudo shutdown -r +5
This schedules a reboot in 5 minutes, giving users time to save their work before the system restarts.
Reboot Immediately
sudo shutdown -r now
This triggers an immediate reboot.
systemctl
to RebootOn modern Linux distributions that use systemd
, the recommended way to reboot is:
sudo systemctl reboot
This approach is clean and reliable, as it works directly with systemd
to manage the shutdown and restart process. It is the preferred method on systems like Ubuntu 20.04 and later, Fedora, CentOS, and most other modern distributions.
In some cases, a normal reboot may not work—for example, if the system is frozen or unresponsive. In those situations, you can try a forced reboot.
Method 1: Using the reboot command
sudo reboot -f
Method 2: Using SysRq triggers
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
⚠️ Caution: Forced reboots should only be used as a last resort. They skip important shutdown steps, meaning the system cannot properly close processes or flush disk writes. This can cause:
Before restarting your Linux system, it’s important to take a few precautions to avoid data loss or unexpected downtime. Follow these steps to ensure a safe reboot:
1. Check Running Processes
Make sure no critical processes will be interrupted:
ps aux | grep important_process
Replace important_process
with the name of a service or application you want to check.
2. Notify Users
Warn all logged-in users about the upcoming reboot:
wall "System will reboot in 5 minutes for maintenance"
The wall command sends a broadcast message to all user terminals. Adjust the time based on your situation.
3. Check System Status
Review system services and logs for potential issues:
systemctl status
journalctl -xe
systemctl status
shows the state of systemd-managed servicesjournalctl -xe
displays detailed recent log messages4. Verify Disk Space
Confirm there’s enough free space on your system:
df -h
Look for partitions above 90% usage, as low disk space can cause problems after a reboot.
5. Backup Critical Data
Always back up important files before rebooting:
tar -czf backup.tar.gz /path/to/important/files
This command creates a compressed archive. Replace /path/to/important/files
with the actual paths you need to secure.
To keep your Linux system stable and secure when rebooting, follow these guidelines:
sudo
wisely – Run commands with sudo instead of logging in as root. This reduces risk and improves security. (See our terminal guide for more on Linux permissions and sudo usage.)logger "Rebooting system due to maintenance update"
The Linux reboot
command is straightforward but highly important. It plays a key role in system maintenance, applying updates, and fixing critical issues. Whether you are rebooting a personal machine, scheduling automated restarts, or managing remote servers in the cloud, knowing how to use reboot commands correctly ensures system stability and prevents common problems.
Learn the basics of the Linux terminal — what it is, how the shell and command prompt work, and how to run your first commands.
Learn how to reboot a Linux system the right way. This guide explains safe reboot methods, common issues, and practical tips for servers, desktops, and automated scripts.
SSH port forwarding is a secure method for accessing remote services, bypassing firewalls, and protecting sensitive data over untrusted networks. This guide covers the three main types—local, remote, and dynamic—with setup steps, real-world use cases, troubleshooting tips, and examples to help you apply them effectively.