Linux and Unix halt, poweroff and reboot commands
About halt, poweroff and reboot
Stop, power down, or reboot the system.
halt, poweroff, and reboot are commands you can run as root to stop the system hardware.
- halt instructs the hardware to stop all CPU functions.
- poweroff sends an ACPI signal which instructs the system to power down.
- reboot instructs the system to reboot.
halt, poweroff and reboot syntax
reboot [OPTION]... [REBOOTCOMMAND]
These programs allow a system administrator to reboot, halt or poweroff the system.
When called with --force or when in runlevel 0 or 6, this tool invokes the reboot system call itself (with REBOOTCOMMAND argument passed) and directly reboots the system. Otherwise this simply invokes the shutdown tool with the appropriate arguments without passing REBOOTCOMMAND argument.
Before invoking reboot, a shutdown time record is first written to /var/log/wtmp
|-f, --force||Does not invoke shutdown and instead performs the actual action you would expect from the name.|
|-p, --poweroff||Instructs the halt command to instead behave as poweroff.|
|-w, --wtmp-only||Does not call shutdown or the reboot system call and instead only writes the shutdown record to /var/log/wtmp.|
|--verbose||Outputs slightly more verbose messages when rebooting, which can be useful for debugging problems with shutdown.|
|RUNLEVEL||reboot will read the current runlevel from this environment variable if set in preference to reading from /var/run/utmp.|
|/var/run/utmp||File where the current runlevel will be read from; this file will also be updated with the runlevel record being replaced by a shutdown time record.|
|/var/log/wtmp||A new runlevel record for the shutdown time will be appended to this file.|
halt, poweroff and reboot examples
If you are logged in as root, issuing the halt command will cease all CPU function on the system. On most systems, this will drop you into single-user mode and then power off the machine.
If you are not logged in as root, you will need to prefix the halt command with sudo to run the command as the superuser.
If you are logged in as root, issuing the poweroff command will send an ACPI hardware signal which will instruct the system to commence with a complete and immediate shutdown. This is roughly equivalent to pressing the power button on a typical desktop computer.
Execute the poweroff command as root.
If you are logged in as root, issuing the reboot command will immediately initiate a reboot sequence. The system will shut down and then commence a warm boot.
Execute the reboot command as root.
shutdown — Schedule a time for the system to be powered down.