reboot Command in Linux: Restart with systemctl and shutdown
Learn reboot command in linux with syntax, essential flags, practical terminal examples, real-world sysadmin workflows, security tips, and troubleshooting.
11 min read
Learn reboot command in linux with syntax, essential flags, practical terminal examples, real-world sysadmin workflows, security tips, and troubleshooting.
- What reboot Does and When to Use It
- Availability and Installation Across Linux Distributions
- Command Syntax, Arguments, and Exit Status Codes
Interactive Builder for this Guide
Build your custom systemd syntax (reboot Command in Linux: Restart with systemctl and shutdown)
[Unit] Description=Core API Node Service After=network-online.target Wants=network-online.target [Service] Type=simple User=www-data WorkingDirectory=/opt/myapp EnvironmentFile=/opt/myapp/.env ExecStart=/usr/bin/node dist/server.js Restart=on-failure RestartSec=5 NoNewPrivileges=true [Install] WantedBy=multi-user.target
After=network-online.targetWaits until host networking is online before launchingUser=www-dataRuns process with least privilege instead of rootRestart=on-failureAutomatically recovers process after crashes (delay 5s)NoNewPrivileges=trueSecurity hardening preventing child privilege escalationUsing the reboot command in linux is one of the most critical administrative operations performed during kernel upgrades, glibc security patching, hardware reconfiguration, and hypervisor maintenance. While typing reboot at a root shell appears straightforward, restarting a multi-user production server involves a carefully orchestrated teardown sequence so active database transactions, open network sockets, and dirty page-cache buffers are not corrupted.
The reboot command in Linux safely restarts the operating system by stopping running services, terminating user processes, flushing filesystem buffers to disk, and instructing the kernel to reset the hardware. On modern systemd distributions, run sudo systemctl reboot for an immediate restart or sudo shutdown -r +5 to schedule a delayed reboot with a broadcast message.
Across modern enterprise distributions—including Ubuntu, Debian, Red Hat Enterprise Linux (RHEL), Rocky Linux, AlmaLinux, Fedora, and Arch Linux—the legacy /sbin/reboot, /sbin/shutdown, and /sbin/halt binaries are symbolic links pointing directly to /bin/systemctl. Whether you invoke sudo reboot, sudo systemctl reboot, or sudo shutdown -r now, the underlying service manager executes the same target transition toward reboot.target.
Understanding the nuances between immediate restarts, scheduled maintenance windows with wall notifications, firmware setup transitions, and emergency kernel resets ensures you can reboot remote bare-metal servers and cloud virtual machines cleanly without triggering unintended downtime or filesystem recovery delays.
What reboot Does and When to Use It
When you execute a standard reboot on a systemd-based Linux host, the command communicates with PID 1 over the private D-Bus socket or /run/systemd/private to isolate and activate reboot.target. First, systemd checks for active inhibitor locks registered via systemd-inhibit (such as unattended package upgrades or active backup jobs). Next, it stops all running service units in reverse dependency order, sending SIGTERM to each control group (cgroup) and waiting up to TimeoutStopSec (typically 90 seconds) before issuing SIGKILL to stubborn processes.
Once user-space daemons have exited, systemd transitions to shutdown.target and invokes systemd-shutdown as PID 1. This binary unmounts all non-root filesystems, remounts the root filesystem as read-only, detaches loopback devices, disassembles software RAID and LVM/dm-crypt volumes, calls the sync(2) system call to flush kernel page caches to non-volatile storage, and finally invokes the reboot(2) system call with the LINUX_REBOOT_CMD_RESTART magic flag to trigger a hardware or hypervisor reset.
Under the hood, reboot gathers runtime telemetry or dispatches control signals by reading virtual filesystems mounted at /proc and /sys, or by communicating with PID 1 (systemd) over D-Bus. Using flags such as -p, -f, -w, -d turns raw process and service tables into actionable diagnostics during incident response.
Availability and Installation Across Linux Distributions
The reboot utility is packaged in systemd-sysv across mainstream Linux distributions. It is pre-installed on standard Ubuntu, Debian, RHEL, Rocky Linux, AlmaLinux, Fedora, and Arch Linux systems, while minimal container images may require manual installation:
Before running administrative tasks or automation scripts, verify whether reboot is installed and inspect which binary path and version your shell resolves:
type -a reboot
reboot --version 2>/dev/null || man -f reboot
# Illustrative output (reviewed against documentation)
reboot is /usr/bin/reboot
reboot (systemd-sysv)
# Debian / Ubuntu
sudo apt-get update && sudo apt-get install -y systemd-sysv
# RHEL / Rocky / AlmaLinux / Fedora
sudo dnf install -y systemd
# Arch Linux
sudo pacman -S --noconfirm systemd-sysvcompat
# Alpine Linux
sudo apk add --no-cache openrc
Command Syntax, Arguments, and Exit Status Codes
reboot [OPTIONS] | systemctl reboot [OPTIONS] | shutdown -r [TIME] [MESSAGE]
Linux provides three primary command syntaxes for restarting a system: reboot [OPTIONS] for concise compatibility, systemctl reboot [OPTIONS] for explicit systemd control and inhibitor inspection, and shutdown -r [TIME] [WALL_MESSAGE] when you need to schedule a restart in the future or broadcast a warning to logged-in SSH sessions.
In the shutdown -r syntax, the TIME argument accepts three formats: the literal keyword now (an alias for +0), a relative offset in minutes written as +m (for example, +15 for fifteen minutes from now), or an absolute 24-hour clock timestamp written as hh:mm (for example, 02:30). Any trailing words after the time specification are concatenated and broadcast to all active pseudo-terminals (pts/*) and virtual consoles (tty*) while creating the /run/nologin lock file five minutes before the restart.
0— Successful execution with no runtime or permission errors.1— Operational failure, unmatched condition, or permission restriction.2— Invalid command-line option or malformed syntax.
Important Options and Flags Reference
| Option / Flag | Long Form / Argument | Technical Behavior and Purpose |
|---|---|---|
-p | --poweroff | Powers off the machine rather than restarting it when invoked via the halt or reboot compatibility binary. |
-f | --force | Forces an immediate reboot by bypassing the clean systemd service stop sequence and invoking the reboot(2) system call directly. |
-w | --wtmp-only | Writes a simulated shutdown and reboot entry to /var/log/wtmp and /var/run/utmp without actually restarting the machine. |
-d | --no-wtmp | Suppresses writing the reboot record to the /var/log/wtmp audit database during system restart. |
--no-wall | --no-wall | Prevents systemd-logind and shutdown from broadcasting a terminal wall notification to logged-in users before restarting. |
-r | --reboot (shutdown) | Instructs the shutdown utility to reboot the host after bringing down services and unmounting filesystems. |
-c | --cancel (shutdown) | Cancels a pending scheduled shutdown or reboot timer and removes the /run/nologin login restriction file. |
--firmware-setup | --firmware-setup (systemctl) | Instructs the system firmware (UEFI) to boot directly into the BIOS/UEFI configuration menu on the next restart. |
In daily administration, the most critical distinction is between a normal graceful restart and the -f (--force) flag. Passing reboot -f once tells PID 1 to skip stopping unit files and jump straight to unmounting filesystems; passing reboot -ff twice bypasses PID 1 completely and calls the kernel reboot(2) syscall immediately—an action equivalent to pressing the physical reset button that should only be used when the init system itself is deadlocked.
When automating reboots in configuration management tools like Ansible or cloud-init, combining systemctl reboot --no-wall or shutdown -r +1 gives remote SSH orchestration wrappers enough time to receive a clean exit code (0) and close the TCP connection gracefully before the remote network stack tears down.
When combining short flags on the command line, POSIX and GNU utilities allow clustering boolean flags behind a single hyphen, provided any option taking an argument appears last. In automated shell scripts, using long-form GNU options where portable makes self-documenting code that is easier to audit during peer review.
Practical Basic and Advanced Usage Examples
1. Restart the System Immediately with systemctl or reboot
On any modern systemd Linux server, run systemctl reboot or the classic reboot command with sudo privileges to initiate an immediate, graceful system restart.
sudo systemctl reboot
# Or using the classic compatibility command:
sudo reboot
# Illustrative output (reviewed against documentation)
Connection to 192.0.2.45 closed by remote host.
Connection to 192.0.2.45 closed.
Both commands notify systemd-logind, stop all running services in reverse dependency order, flush dirty filesystem pages to disk, and reset the machine.
2. Schedule a Delayed Reboot with a Broadcast Message
When multiple engineers or application users are logged into a shared server, schedule the restart 10 minutes ahead using shutdown -r so active sessions receive a warning.
sudo shutdown -r +10 "Kernel security update (CVE-2026-XXXX) — save open work"
# Illustrative output (reviewed against documentation)
Reboot scheduled for Thu 2026-10-22 19:15:00 UTC, use 'shutdown -c' to cancel.
Systemd creates a scheduled timer, broadcasts the custom message across all open PTY terminals periodically, and blocks new non-root SSH logins via /run/nologin five minutes prior to execution.
3. Schedule a Reboot for a Specific Maintenance Window Time
Use 24-hour clock notation (HH:MM) with shutdown -r to queue an unattended restart for an off-peak maintenance window.
sudo shutdown -r 03:00 "Scheduled nightly maintenance window reboot"
# Illustrative output (reviewed against documentation)
Reboot scheduled for Fri 2026-10-23 03:00:00 UTC, use 'shutdown -c' to cancel.
The timer remains active in systemd-logind until 03:00 local server time. You can inspect the pending schedule at any time by reading /run/systemd/shutdown/scheduled.
4. Cancel a Pending Scheduled Reboot
If a deployment window changes or an urgent task is still running, abort a queued shutdown or reboot timer with shutdown -c.
sudo shutdown -c "Maintenance window postponed until tomorrow"
cat /run/systemd/shutdown/scheduled 2>/dev/null || echo "No reboot currently scheduled"
# Illustrative output (reviewed against documentation)
No reboot currently scheduled
The -c flag clears the active shutdown timer in systemd-logind, deletes /run/nologin so standard SSH users can log in again, and broadcasts the cancellation notice.
5. Record a Simulated Reboot Entry in wtmp Without Restarting
Use the -w (--wtmp-only) option to test log rotation or audit monitoring scripts that parse /var/log/wtmp without actually taking the host offline.
sudo reboot -w
last -x -n 2 reboot
# Illustrative output (reviewed against documentation)
reboot system boot 6.8.0-45-generic Thu Oct 22 19:05 still running
wtmp begins Thu Oct 01 00:00:02 2026
The -w flag writes a record to the wtmp accounting file for testing compliance pipelines while leaving all running services and uptime completely untouched.
6. Reboot Directly into UEFI Firmware Setup or Specific Boot Loader Entry
On UEFI-enabled hardware or virtual machines, instruct systemd to set the EFI OsIndications variable so the machine boots into the firmware interface on restart.
sudo systemctl reboot --firmware-setup
# Illustrative output (reviewed against documentation)
Rebooting into firmware setup interface...
If supported by the motherboard or hypervisor OVMF firmware, the system automatically enters the UEFI BIOS setup screen on the next boot cycle.
Real-World Workflows, Pipelines, and Shell Automation
Pre-Reboot Production Health Check and Inhibitor Audit
Before restarting a production node after patching, verify whether a kernel reboot is actually required, check for active systemd inhibitor locks, and validate configuration syntax for critical services.
#!/usr/bin/env bash
set -euo pipefail
echo "=== 1. Checking if kernel or core library reboot is required ==="
if [ -f /var/run/reboot-required ]; then
cat /var/run/reboot-required
cat /var/run/reboot-required.pkgs 2>/dev/null || true
elif command -v needs-restarting >/dev/null 2>&1; then
needs-restarting -r || true
fi
echo "=== 2. Auditing active systemd inhibitor locks ==="
systemd-inhibit --list
echo "=== 3. Checking active user sessions and fstab mount integrity ==="
who
sudo findmnt --verify
echo "=== 4. Scheduling graceful reboot in 2 minutes ==="
sudo shutdown -r +2 "Automated post-patch reboot after pre-flight verification"
# Illustrative output (reviewed against documentation)
=== 1. Checking if kernel or core library reboot is required ===
*** System restart required ***
linux-image-6.8.0-45-generic
=== 2. Auditing active systemd inhibitor locks ===
WHO UID USER PID COMM WHAT WHY MODE
unattended-upgr 0 root 4112 unattended-upg shutdown Installing upgrades delay
=== 3. Checking active user sessions and fstab mount integrity ===
admin pts/0 2026-10-22 18:40 (198.51.100.12)
Success, no errors or warnings detected
=== 4. Scheduling graceful reboot in 2 minutes ===
Reboot scheduled for Thu 2026-10-22 19:08:00 UTC, use 'shutdown -c' to cancel.
Running findmnt --verify before rebooting is one of the highest-leverage sysadmin habits: it catches typos in /etc/fstab before they drop your remote server into an unreachable emergency-mode shell during boot.
Fast Kernel Reboot Using kexec to Bypass Hardware POST
On bare-metal enterprise servers where BIOS/UEFI memory training and hardware POST take several minutes, load the new kernel directly into memory with kexec and trigger a fast systemctl kexec restart.
# Load the newly installed kernel and initramfs into memory
NEW_KERNEL=$(ls -1 /boot/vmlinuz-* | sort -V | tail -n 1)
NEW_INITRD="/boot/initrd.img-${NEW_KERNEL#/boot/vmlinuz-}"
CMDLINE=$(cat /proc/cmdline)
sudo kexec -l "$NEW_KERNEL" --initrd="$NEW_INITRD" --command-line="$CMDLINE"
sudo systemctl kexec
# Illustrative output (reviewed against documentation)
Stopping services and executing kexec jump to /boot/vmlinuz-6.8.0-45-generic...
systemctl kexec performs the full, safe systemd service shutdown and filesystem unmount sequence, but instead of triggering a hardware reset, it jumps directly into the preloaded kernel image—cutting bare-metal reboot downtime from minutes to seconds.
Pipelines, Redirection, Quoting, and Shell Expansion
When embedding reboot inside shell pipelines (|), conditional chains (&& and ||), or command substitutions ($(...)), the calling shell performs tilde expansion, variable interpolation, and globbing before invoking the binary. Always wrap paths, patterns, and variables in quotes so whitespace and wildcard characters (*, ?) are not expanded prematurely, and use set -euo pipefail in unattended scripts.
Permissions, Security Implications, and Safe Execution
Never run reboot -f or reboot -ff on a functioning production server unless the init system is completely unresponsive. Forced reboots skip service shutdown hooks and filesystem unmounts, which can corrupt active databases (PostgreSQL, MySQL) and trigger lengthy journal replay on startup.
Restarting a Linux host is a privileged operation governed by PolicyKit (polkit) and root credentials. When an unprivileged user runs systemctl reboot from a local graphical seat, Polkit may permit the restart only if no other users are logged in; over remote SSH sessions, Polkit denies unprivileged reboot requests and requires explicit sudo elevation.
Every reboot and shutdown event is logged both to the systemd journal and to the binary accounting file /var/log/wtmp. Security teams can audit historical restarts and distinguish between graceful administrative reboots and unexpected kernel panics or power losses by running last -x reboot shutdown and journalctl --list-boots.
GNU/Linux, BSD, and BusyBox Implementation Differences
On systemd distributions (Ubuntu, Debian, RHEL, Fedora, Arch), reboot, shutdown -r, and systemctl reboot all route through PID 1. On Alpine Linux (which uses OpenRC and BusyBox init) and Void Linux (runit), systemctl does not exist; use sudo reboot or sudo shutdown -r now instead.
On FreeBSD and macOS, the shutdown -r now command is preferred over raw reboot because BSD's shutdown executes /etc/rc.shutdown hooks cleanly, whereas BSD reboot only sends SIGTERM to processes without running full RC stop scripts.
Troubleshooting Common Errors and Diagnostics
System hangs on 'A stop job is running for...' during reboot
Root Cause: A service unit (such as a hung network mount, database, or container runtime) is ignoring SIGTERM and delaying the transition to reboot.target until TimeoutStopSec expires.
Resolution: Inspect which unit is blocking shutdown or lower DefaultTimeoutStopSec in /etc/systemd/system.conf, and unmount stale NFS/CIFS shares lazily before restarting.
sudo systemctl list-jobs
sudo umount -l -t nfs,nfs4,cifs -a 2>/dev/null || true
sudo systemctl reboot
Operation inhibited by 'unattended-upgrades' or another active process
Root Cause: An active process holds a systemd block or delay inhibitor lock to prevent package database corruption during a restart.
Resolution: List active locks with systemd-inhibit --list and wait for the package manager to finish before forcing the reboot.
systemd-inhibit --list
ps -ef | grep -E 'apt|dpkg|dnf'
Server fails to come back online on SSH after reboot
Root Cause: An invalid entry in /etc/fstab without the nofail option caused systemd to drop into Emergency Mode on the local console before sshd could start.
Resolution: Always run sudo findmnt --verify and sudo sshd -t prior to issuing a reboot command on a remote server.
sudo findmnt --verify
sudo sshd -t
Alternatives, Related Commands, and Related Tutorials
- systemctl Command in Linux: Start, Stop, Enable, and Manage Services — Practical syntax, flags, and examples for
systemctl. - How to Create a systemd Service in Linux: Unit File Tutorial — Practical syntax, flags, and examples for
systemd. - List Linux Services with systemctl: Status, Units, and States — Practical syntax, flags, and examples for
systemctl. - uptime Command in Linux: Check System Uptime and Load Average — Practical syntax, flags, and examples for
uptime. - 25 Best Linux Commands Every Sysadmin Should Know — Core command-line utilities for daily Linux server administration.
- How to Find a File in Linux from the Command Line — Practical file search patterns across Linux directories.
- Linux Commands Knowledge Hub (#linux-commands) — Browse all Linux command-line tutorials and system administration references.
Authoritative References and Official Documentation

The Linux Command Line, 2nd Edition: A Complete Introduction
Frequently Asked Questions
Quick answers to common questions and configurations
/sbin/reboot and /sbin/shutdown are symlinks to systemctl. The main practical difference is that shutdown -r accepts a time schedule (+10 or 02:00) and a custom broadcast message./var/log/wtmp.Editorial Disclosure: Website Vidya is supported by our readers. When you purchase hosting, tools, or software through our verified partner links, we may earn an affiliate commission at no extra cost to you. We only recommend solutions we trust and rigorously verify.
Rajesh Ray
I’m Rajesh Rai, a full-stack developer, Linux administrator, and technology enthusiast passionate about making complex technology easier to understand and use.
Most Read Guides
TrendingUbuntu Server Not Booting? 10 Simple Steps to Fix It Fast
How to Create a 3D Button in HTML and CSS: Easy Steps
How to Install Python and Pip on Ubuntu 24.04 LTS
How to Install Nginx on Ubuntu 24.04
How to Install Python on Ubuntu 24.04 LTS
Related Technical Guides
Tested runbooks, server administration walkthroughs, and troubleshooting guides

Join the Conversation & Perspective
Have thoughts, counterpoints, or reflections on this story? Engage directly with fellow readers and editorial contributors.
No comments on this guide yet. Be the first to share your thoughts or ask a question!