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 reboot
  • sudo shutdown -r now
  • sudo 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:

  1. Termination Signals: The init system sends a SIGTERM (Signal Terminate) to all running processes, giving them a chance to save data and close files.
  2. Forceful Closure: After a specific timeout, processes that haven't closed are sent a SIGKILL (Signal Kill) to force them to stop.
  3. Filesystem Sync: The system executes a sync operation to flush buffered data to the physical disks, preventing filesystem corruption.
  4. Unmounting: Filesystems are unmounted or remounted as read-only.
  5. 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: