sudo systemctl rebootis the modern command.sudo rebootandsudo shutdown -r nowdo the same thing on any current distribution.- Schedule one with
sudo shutdown -r +10 'message'and cancel it withsudo shutdown -c. - Check
/var/run/reboot-requiredbefore rebooting: it tells you whether a kernel or library update actually needs one. - Confirm every service is set to start at boot before you restart, or the server will come back up without your site on it.
- Never use
reboot -f: it skips the shutdown sequence entirely and is the fastest way to corrupt a database.
What is the command to reboot a Linux server?
Use sudo systemctl reboot. It asks systemd to stop every service cleanly, unmount the filesystems and restart. On any distribution released in the last decade, sudo reboot and sudo shutdown -r now are aliases for the same thing, so pick whichever you remember.
# The modern form, and the one to prefer
sudo systemctl reboot
# Short form: identical behaviour on systemd distributions
sudo reboot
# The traditional form, still supported everywhere
sudo shutdown -r now| Command | What it does |
|---|---|
| systemctl reboot | Clean restart: stops services, unmounts, restarts |
| systemctl poweroff | Clean shutdown, machine stays off |
| shutdown -r +10 | Restart in ten minutes, warns logged-in users |
| shutdown -c | Cancel a scheduled shutdown or restart |
| systemctl suspend | Sleep. Almost never what you want on a server |
The only two you need day to day are the first and the fourth.
Never use reboot -f
The force flag skips the shutdown sequence completely: no service gets a chance to flush its buffers and no filesystem is unmounted. It is the equivalent of pulling the power cable, and it is how MySQL tables get corrupted. Reserve it for a machine that is already unresponsive to everything else.
How do I schedule a reboot for later?
Use shutdown with a time. It broadcasts a warning to anyone logged in, blocks new logins in the final five minutes, and can be cancelled right up until it fires. That last part is the reason to prefer it over a cron job.
# In 10 minutes, with a message to logged-in users
sudo shutdown -r +10 'Kernel update, back in about 2 minutes'
# At a specific time, 24-hour clock, server local time
sudo shutdown -r 02:30 'Scheduled maintenance window'
# Change your mind
sudo shutdown -c
# Check whether one is already scheduled
systemctl list-jobs | grep -i shutdowntimedatectl first if the server might be on UTC while you are not.If you are on the machine over SSH, run the reboot inside tmux or screen. When the connection drops mid-command you will still see the output when you reconnect, rather than wondering whether the command ever ran.
Do I actually need to reboot?
Usually not. Most updates take effect the moment the service restarts, and restarting one service beats restarting the whole machine. A reboot is genuinely required for a kernel update, a glibc update, or a firmware or hypervisor change. Debian and Ubuntu tell you directly.
# Debian / Ubuntu: this file exists only if a reboot is needed
ls -l /var/run/reboot-required 2>/dev/null && cat /var/run/reboot-required.pkgs
# RHEL family: needs-restarting is in the dnf-utils package
sudo needs-restarting -r
# Which services are running against deleted libraries?
sudo needs-restarting -s # RHEL family
sudo checkrestart # Debian / Ubuntu, from debian-goodiesneeds-restarting -r exits 0 if no reboot is required and 1 if one is, so it works in a script.If a service is just holding an old library, restart that service instead. It costs seconds rather than minutes and nothing else on the machine notices.
sudo systemctl restart nginx
sudo systemctl restart php8.3-fpm
sudo systemctl restart mariadb
# Reload rather than restart where the service supports it:
# rereads config with no dropped connections
sudo systemctl reload nginxreload is not the same as restart. Nginx reloads with zero dropped requests; PHP-FPM needs a restart for most changes.What should I check before rebooting a production server?
The risk in a reboot is almost never the reboot itself. It is discovering, two minutes later, that something was running only because someone started it by hand months ago and never enabled it at boot. Run through these five checks first.
- 1Confirm every service you depend on is enabled at boot.
systemctl list-unit-files --state=enabledlists what will actually start. If nginx, php-fpm or your database is missing from that list, fix it before you restart, not after. - 2Check nothing long-running is in flight. A backup, a database import or a large rsync will be killed mid-write.
ps aux | grep -E 'rsync|mysqldump|tar'takes two seconds. - 3Take a backup you have tested. A reboot exposes problems that were already there, such as a filesystem that will not mount cleanly. Have a way back. Our backup strategy guide covers what makes a backup usable.
- 4Know how you get in if SSH does not come back. Console access through your provider's panel, or a second route in. Without it, a failed boot means a support ticket and an unknown wait.
- 5Pick a genuinely quiet window. Check your traffic, not your assumptions about it. Overnight in your timezone is peak somewhere else if you have international visitors.
# Will everything come back on its own?
systemctl list-unit-files --state=enabled | grep -E 'nginx|apache|php|maria|mysql|postgres'
# Anything long-running I would be killing?
ps aux | grep -E '[r]sync|[m]ysqldump|[t]ar|[a]pt|[d]nf'
# Any failed units already? Fix these first, a reboot will not help
systemctl --failed
# How long has it been up, and what is the load?
uptimesystemctl --failed before a reboot saves you from blaming the restart for a problem that was already there.How do I confirm the server came back correctly?
Do not stop at a successful SSH login. The machine being up and the site being up are different claims. Check the boot itself, then the services, then the site.
# Confirm it really did restart, and when
uptime -s
who -b
# Did anything fail to start?
systemctl --failed
# How long did the boot take, and what was slow?
systemd-analyze
systemd-analyze blame | head -10
# Read this boot's log for errors only
sudo journalctl -b -p err
# Finally, test the site from outside the server
curl -s -o /dev/null -w '%{http_code} in %{time_total}s\n' https://example.com/journalctl -b limits output to the current boot, which is what you want after a restart.The check that matters is from outside
A service that is running is not the same as a site that answers. The last command above tests the whole path: DNS, the network, the proxy and the application. If you want that check running continuously, uptime monitoring does it every minute from outside your network.
If something did fail to start, the log will say why. Understanding Linux system logs covers reading journalctl and finding the service-specific logs underneath it.
What do I do if the server will not come back?
Give it longer than you think. A machine that fsck's a large filesystem, or waits on a network mount, can take several minutes with no external sign of life. If it is still silent after ten, work through this in order.
- 1Ping it. If it answers ping but refuses SSH, the machine booted and the problem is sshd or a firewall rule, which is a much better position to be in.
- 2Open the provider's console. Serial or VNC console shows you the boot messages directly. That is where a failed mount or a kernel panic will be visible.
- 3Look for a filesystem check. A large disk being verified can take a long time and will tell you so on the console. The right response is to wait.
- 4Boot the previous kernel. If the reboot followed a kernel update, pick the older entry in the GRUB menu from the console. If it boots, you have your answer.
- 5Boot into rescue mode to repair a bad fstab entry or a broken mount, which is the most common cause of a machine that hangs during boot.
An untested fstab entry is the classic cause
A new mount added to /etc/fstab with a typo will stop the boot dead, and you will not find out until the next restart, possibly months later. After editing fstab always run sudo mount -a and confirm it returns cleanly before you reboot.
Frequently asked questions
What is the difference between reboot, shutdown -r and systemctl reboot?
On any current systemd distribution, none. reboot and shutdown -r now are both handled by systemd and run the identical clean shutdown sequence as systemctl reboot. The shutdown form is the only one that also accepts a delay and a broadcast message.
How do I cancel a scheduled reboot on Linux?
Run sudo shutdown -c. It cancels any pending shutdown or restart and sends a cancellation notice to logged-in users. This only works for jobs scheduled with shutdown; a reboot scheduled through cron or a systemd timer has to be removed from there.
How do I know whether my Linux server needs a reboot?
On Debian and Ubuntu, check whether /var/run/reboot-required exists; the companion .pkgs file lists which packages asked for it. On AlmaLinux, Rocky and RHEL, run sudo needs-restarting -r, which exits 0 when no reboot is needed.
Will rebooting my server fix high CPU or memory usage?
It will clear the symptom and not the cause, and it will come back. A reboot is worth doing to recover a wedged machine, but find what was consuming the resource first. Our guide to troubleshooting high CPU and memory on WordPress walks through it.
How long should a Linux server take to reboot?
Typically 30 to 90 seconds for a virtual machine and two to five minutes for physical hardware, which spends most of that in firmware before Linux even starts. Run systemd-analyze afterwards for the exact split between firmware, kernel and userspace.
About G7Cloud Engineering
Articles written by the engineers who build and run G7Cloud: UK managed hosting and the AI Website Builder. We write about what we operate every day: containers, backups, databases, and the small-business websites that run on them.
More about G7Cloud →