Home Learn Linux Reboot Command in Linux with examples

Reboot Command in Linux with examples

by Habib Ahmed
Reboot Linux Command

The reboot command is used to reboot or restart the system in Linux. Whenever you make significant updates to the Linux system or any network configuration changes, you may need to restart your system to make these changes effective. These can be software or hardware updates that are being carried by the server.

For example, to update the new server kernel version, you need to complete the compilation, and for this purpose, a system reboot is necessary. When updating the server’s memory, NIC configuration and IP allocation are the main tasks that are complete when a reboot is done.

To perform the administrative activities, monitoring, and server management, several administrators of Linux system use servers through shell or SSH. So, the basic reboot commands of the server through shell are essential to know.

Linux Reboot Command

Syntax:

reboot [options]

Here [options] are following:

  • -help: help command will open the instructions text for this command
  • -halt: halt command will stop the machine.
  • -w, -wtmp-only: This command option writes only wtmp shutdown entry, but in reality, it didn’t halt, reboot, power-off the system.

Restart The System

To restart your system without going into details, use any of the below commands.

$ sudo reboot

Or you can use the shutdown command.

$ sudo shutdown -r now

These commands are almost the same in syntax and effect. To see more details of these commands, use -help while in that command.

Schedule A Restart

Reboot command has limited usage, but the shutdown command is an advanced version of the reboot. In scheduling, the shutdown command is commonly used to fulfill the requirements. Below is the syntax of the shutdown command to reboot the system at a specific time.

$ sudo shutdown -r [TIME] [Message]

Here [Time] can be in the following formats:

now: It is used if you want to restart the system right away.

+m:  It indicates the time in minutes. +10 means restart the system in the next 10 minutes.

HH:MM: It indicates the time in a 24-hour clock.

[Message] is an optional parameter used to display users a notice text before the system reboot to avoid data loss.
$ sudo shutdown –r +10

The above command will reboot your system after 10 minutes.

schedule reboot on linux

schedule reboot on Linux

$ sudo shutdown –r 04:00

The above command will reboot your system at 04:00 AM.

If you want to change the previous scheduled system restart or shutdown, you can call another shutdown command along with the -c option. Also, broadcast the cancellation restart message to users.

$ sudo shutdown -c

Restart remotely server

Login server to server using the SSH client and run below command

$ ssh root@foss-server.com /sbin/reboot

Or you can use the shutdown command

$ ssh root@196.162.1.12 /sbin/shutdown -r now

Restart with the Init command

The init command is a widely used command to start the processes in Linux and joint with the runlevel 6; (a number that is set to reboot the Linux server). The command syntax is below.

$ init 6

OR

$ /sbin/init 6

Checking your reboot logs

‘/var/log/wtmp’ is a file record containing all logins and logouts records. You can see this file with the reboot command along with the last option. Below is the syntax of the last command, usage, and output.

$ last reboot

Example:

checking reboot logs

checking reboot logs

Conclusion

Before using the reboot command in your Linux system, it’s important to save all the unsaved documents in your session type. Then type reboot in your terminal. The machine will immediately close all applications and restart.

You may also like

Leave a Comment

fl_logo_v3_footer

ENHANCE YOUR LINUX EXPERIENCE.



FOSS Linux is a leading resource for Linux enthusiasts and professionals alike. With a focus on providing the best Linux tutorials, open-source apps, news, and reviews written by team of expert authors. FOSS Linux is the go-to source for all things Linux.

Whether you’re a beginner or an experienced user, FOSS Linux has something for everyone.

Follow Us

Subscribe

©2016-2023 FOSS LINUX

A PART OF VIBRANT LEAF MEDIA COMPANY.

ALL RIGHTS RESERVED.

“Linux” is the registered trademark by Linus Torvalds in the U.S. and other countries.