How does reboot command work in linux




















For laptop and desktop users, though, that metric is a little extreme. Before continuing though, a note on rebooting. Rebooting is a unique process on each operating system. Even within POSIX systems, the commands to power down and reboot may behave differently due to different initialization systems or command designs. Despite this factor, two concepts are vital.

Second, rebooting is meant to be a friendly process, allowing time for programs to exit, files to be saved, temporary files to be removed, filesystem journals updated, and so on. Whenever possible, reboot using the intended interfaces, whether in a GUI or a terminal. Since powering down and rebooting are common tasks on a workstation, you can usually find the power button typically with reboot and shut down options in a few different places.

You can also access the KDE power controls by right-clicking on the desktop and selecting the Leave option, which opens the window you see here:. Other desktops provide variations on these themes, but the general idea is the same: use your mouse to locate the power button, and then click it. You may have to select between rebooting and powering down, but in the end, the result is nearly identical: Processes are stopped, nicely, so that data is saved and temporary files are removed, then data is synchronized to drives, and then the system is powered down.

Most computers have a physical power button. If you press that button, your Linux desktop may display a power menu with options to shut down or reboot. If you want to change this setup, you can do so in your system settings.

Next, select the Power category in the left column, which opens the following menu:. The process is similar across desktops. Depending on your computer vendor or parts vendors, if you build your own , a button press might be a light tap, or it may require a slightly longer push, so you might have to do some tests before you get the hang of it. If you operate more in a terminal than in a GUI desktop, you might prefer to reboot with a command.

Broadly speaking, rebooting and powering down are processes of the init system—the sequence of programs that bring a computer up or down after a power signal either on or off, respectively is received. On most modern Linux distributions, systemd is the init system, so both rebooting and powering down can be performed through the systemd user interface, systemctl.

The systemctl command accepts, among many other options, halt halts disk activity but does not cut power reboot halts disk activity and sends a reset signal to the motherboard and poweroff halts disk acitivity, and then cut power. These commands are mostly equivalent to starting the target file of the same name.

The shutdown command, for instance, can power down your machine, but it has several options to control exactly what that means. This command requires a time argument, in minutes, so that shutdown knows when to execute. To reboot immediately, append the -r flag:. The shutdown command is a safe way to power off or reboot your computer, allowing disks to sync and processes to end. This command prevents new logins within the final 5 minutes of shutdown commencing, which is particularly useful on multi-user systems.

On many systems today, the shutdown command is actually just a call to systemctl with the appropriate reboot or power off option. The reboot command, on its own, is basically a shortcut to shutdown -r now. From a terminal, this is the easiest and quickest reboot command:.

By default, it will take time strings that let you reboot some time into the future. The syntax for a time stream is " hh:mm ", where "hh" is the hour and "mm" is the minute of the time you want to reboot in the hour clock format. For example, if you wanted to reboot your system at midnight, you'd issue this command:. For example, to reboot in five minutes:. The second argument is a "wall message," which prints a message to every terminal connected to the system.

On a shared system like a server, it's a good idea to give other active users a heads-up so they can save their work. If you've changed your mind and want to cancel a reboot you've scheduled, type:. The reboot and shutdown commands work on both local and remote systems.

If you're connected to a server over SSH , when you reboot, you will be disconnected unless you're connected to a serial console. If something goes wrong with the system and you were logged in over SSH, you might only be able to log in again directly on a terminal connected to the system. For things like big databases, this can be a pretty big task all on its own.

But ultimately, the processes must be terminated so that all their files can be closed, to allow the filesystems to unmount cleanly. Modern filesystems may record the fact that they have been properly unmounted in an error-free state and there will be no need for recovery actions before mounting them again.

Improve this answer. This is a good expl. And in fact you say there are different ways tu shut down a system, and to store the settings as configurations AND when you think of kexec. I recommend a technical condensation of your answer. NOT the details! The precise terminolgy with definitions, explanations and examples. Even systemd's initrd at shutdown is just a detail. Just define what a "clean" shutdown is, how to make one.

If you have e. Add a comment. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Next find command in Linux with examples. Recommended Articles. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide.

Load Comments. What's New.



0コメント

  • 1000 / 1000