Javatpoint Logo
Javatpoint Logo

Linux Reboot Command

Overview

Reboot command in Linux is used for rebooting or restarting the system. There comes a requirement in a Linux administration for restarting the server after the end of a few networks and other large updates.

It could be hardware or software that is being borne on a server. The reboot command is required so that the modifications that the users have implemented could be impacted on a server.

For example, when the user re-compiled the kernel of the server that is going by a few more standard server administrations. After that, the user requires to reboot the system to finish the compilation process and to include a new version of the updated kernel over the server.

If updating the memory, NIC configuration, key tasks, and IP allocation of the server that require to be implemented over the server rebooted once leading to their implementation successfully.

Most of the administrations of the Linux system access their server by SSH or shell for performing a collection of administrative actions, server monitoring, and management.

Hence, they require to know the common commands for restarting the server through the shell.

Syntax of the reboot command

Options in reboot command

1. --help: This option is used for printing a short text of help and exit.

2. --halt: It is used to halt a machine, unconcerned of which of the below commands are conjured:

3. -poweroff, -p: This option will help to power off the system, unconcerned of which of these three commands are conjured.

4. -reboot: It restarts the system, unconcerned of which of these three commands are conjured.

5. -force, -f: It forces immediate halt, reboot, or power-off. It results in an immediate but clear shutdown via the system manager when it is described once. It results in an immediate shutdown by no contacting any system manager when it is described twice.

6. -wtmp-only, -w: It only writes the entries of the wtmp shutdown. It doesn't halt, reboot, or power off.

Examples of reboot command

1. Restart our system: When we just require is a reboot without going inside the details. We can use any of the below commands:


Linux Reboot Command


Linux Reboot Command

Note: The usage of the halt, power-off, and reboot are almost the same in effect and syntax. Run all the commands using --help option to check the details.

2. Scheduled a Reboot: General reboot command has restricted usage. Besides, the shutdown command is being applied rather than the reboot command for fulfilling much more standard shutdown and reboot needs.

One of those conditions is a scheduled reboot. The below is the syntax that is being used for rebooting our system after the time specified via the TIME.

Where,

  • The TIME contains several formats. The simplest format is "now". It tells the machine to immediately restart.
  • Other authorized formats we have are +m, in which m is the count of minutes we require to wait until reboot.
  • HH:MM format defines the TIME inside a 24-hour clock.
  • MESSAGE arguments (optional) could be used to indicate the users before preventing certain data loss.

The following are some examples and their corresponding outputs.

The command for restarting our system after 2 minutes


Linux Reboot Command

The command for restarting our system after 03:00 A.M:

How to cancel a Reboot

If we wish our system to remove the previously scheduled shutdown or restart, simply we can call other shutdown commands using an option, i.e., -c, and broadcast with the cancellation message of the reboot to the users.

Syntax:

Cancel our scheduled Restart: The scheduled reboot (previously) could be canceled via the system administrator by issuing other shutdown commands simply using an option, i.e., -c and a message argument (optional).


Linux Reboot Command

Restart using the init command: Actually, the init command is taken by the initialize word. It is hugely been used to start/initialize distinct processes within a Linux system. Hence, this command applied as a joint along with the 6 runlevel; a number that is been fixed to reboot a Linux server leads to get the server restarted. The syntax for it is mentioned as follows:


Linux Reboot Command

OR,

Checking our reboot logs: The file, i.e., /var/log/wtmp is a record where every record of logout and login is kept. We can translate this file using a command, i.e., "last" for accessing the log for the restart. The usage of the last command and its outcomes on our system is mentioned as follows:


Linux Reboot Command





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA