Home
How to Use the Linux Restart Command to Safely Reboot Your System
Restarting a Linux system from the command line interface (CLI) is a fundamental skill for system administrators and developers alike. While the process may seem as simple as typing a single word, understanding the nuances behind various commands—such as reboot, shutdown, and systemctl—is crucial for maintaining data integrity and ensuring system stability.
To restart a Linux system immediately, the most common commands are:
sudo rebootsudo shutdown -r nowsudo systemctl reboot
Each of these commands requires superuser (root) privileges, typically invoked using sudo. While they all lead to the same end result—a system restart—they function differently under the hood and offer various features like scheduling and user notification.
The Technical Mechanism Behind a Linux Restart
Before diving into the specific commands, it is essential to understand what happens when a Linux machine restarts. A "graceful" restart is not merely a sudden loss of power. It is a orchestrated sequence of events managed by the init system, which in most modern distributions (Ubuntu, CentOS, Fedora, Debian, RHEL) is systemd.
When a restart command is issued:
- Termination Signals: The init system sends a
SIGTERM(Signal Terminate) to all running processes, giving them a chance to save data and close files. - Forceful Closure: After a specific timeout, processes that haven't closed are sent a
SIGKILL(Signal Kill) to force them to stop. - Filesystem Sync: The system executes a
syncoperation to flush buffered data to the physical disks, preventing filesystem corruption. - Unmounting: Filesystems are unmounted or remounted as read-only.
- Kernel Handover: The kernel is instructed to perform a soft reset, or in the case of
kexec, load a new kernel directly.
Using the reboot Command
The reboot command is perhaps the most intuitive way to restart a Linux machine. It is a legacy command that, on modern systems, is actually a symlink to the systemctl utility, but it remains the go-to for many users due to its brevity.
Standard Usage
To restart the system immediately, simply run:
-
Topic: How to boot, shut down, and suspend your system from the Linux command linehttps://www.redhat.com/ko/blog/linux-boot-shutdown-systemd
-
Topic: reboot Command in Linux: Restart with systemctl and shutdown -r | Linuxizehttps://linuxize.com/post/reboot-linux-using-command-line/
-
Topic: How to Use the Linux Restart Command to Reboot Your Serverhttps://commandlinux.com/how-to/linux-restart-command/