Linux Halt command parameters and usage detailed

Source: Internet
Author: User
Tags file system

Name: Halt

Use Permissions: System Manager

How to use: Halt [-N] [-W] [-d] [f] [-i] [P]

Note: If the system RunLevel is 0 or 6, then shut down the system, otherwise the shutdown instruction (plus-h parameter) to replace


-N: Do not write the memory data back to the hard drive before shutting down

-W: It doesn't really turn off, it just writes the records to the/var/log/wtmp file.

-D: Do not write records to the/var/log/wtmp file (-n This parameter contains-D)-F: Forced shutdown, do not call shutdown this command

-I: All network-related devices should be stopped before shutdown

-P: When the shutdown, by the way to turn off the Power (Poweroff) action


Halt-p power off after shutting down the system.

Halt-d shuts down the system, but does not leave a record.

Linux common shutdown commands and their differences:

Under Linux some commonly used shutdown/Restart commands are shutdown, halt, reboot, and INIT, they can achieve the purpose of restarting the system, but the internal process of each command is different, through the introduction of this article, I hope you can more flexible use of a variety of shutdown commands.


The shutdown command shuts down the system securely.

It is very dangerous for some users to turn off Linux by simply breaking the power off. Because Linux differs from windows in that it runs many processes in the background, forcing a shutdown can cause data loss in the process, leaving the system in an unstable state, or even damaging hardware devices in some systems.

Using the shutdown command before the system shuts down, the system administrator notifies all logged-in users that the system will be closed. And the login command is frozen, that is, the new user can no longer log in. It is possible to turn off the machine directly or delay it for a certain time, and it may be heavy

Kai. This is determined by the signal (signal) that all process (process) will receive the system delivery. This lets programs like VI have time to store documents that are currently being edited, and programs like Mail (mail) and news (news) can leave and so on.

Shutdown performs its work by sending signals (signal) to the INIT program, requiring it to change runlevel. RunLevel 0 is used to stop (halt),runlevel 6 is used to reactivate the (reboot) system, while RunLevel 1 is used to allow the system to enter the state that management can perform; This is a preset, assuming no-H and no-R parameter to shutdown. To find out what you did during the downtime (halt) or reboot (reboot), you can see the runlevels related information in this file/etc/inittab.

Shutdown parameter Description:

[-T] tell Init how long to shut down before changing to another runlevel.

[-R] to restart the calculator.

[K] does not really shut down, just send a warning signal to each login (login).

[-h] turn off the power (halt) after shutting down the computer.

[-n] do not need to init, but to shut down the machine. Use of this option is discouraged, and the consequences of this option are often not always what you expect.

[-c] Cancel current process cancels the currently executing shutdown program. So this option certainly does not have a time parameter, but you can enter a message to interpret, and this information will be sent to each user.

[-f] ignores fsck while restarting Calculator (reboot).

[-f] Forces fsck when the calculator (reboot) is restarted.

[-time] Sets the time before the shutdown (shutdown).

2.halt--the simplest shutdown command

In fact, halt is called shutdown-h. Halt executes, kills the application process, performs the sync system call, and stops the kernel after the file system write operation completes.

Parameter description:

[-n] Prevents sync system calls, which are used after patching the root partition with fsck to prevent the kernel from overwriting the patched super blocks with the old version of the Super Block (superblock).

[-W] is not a real reboot or shutdown, just write Wtmp(/var/log/wtmp) records.

[-d] does not write Wtmp records (already included in options [-n]).

[-f] forced shutdown or reboot without invoking shutdown.

[-i] turn off all network interfaces before shutting down (or rebooting).

[-p] This option is the default option. is to call Poweroff when shutdown.


Reboot's work process is almost the same as halt, but it triggers a host reboot, and Halt is shutdown. Its parameters are not much different from the halt.


Init is the ancestor of all processes, and its process number is always 1, so sending term signals to init terminates all user processes ﹑ daemons, and so on. Shutdown is the use of this mechanism. Init defines 8 run levels (RunLevel), and init 0 restarts,init1 for shutdown. There is no longer a narrative about init that can be lengthy. There are also telinit commands that can change the running level of init, such as,telinit-is, which allows the system to enter Single-user mode, and does not have the information and latency to use shutdown.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.