Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the restart commands under ​ Linux

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces what restart commands are available under Linux, which can be used for reference by friends who need them. I hope you will learn a lot after reading this article. Next, let the editor take you to learn about it.

The restart commands under Linux are: shutdown command can safely shut down the system, the simplest shutdown command halt command, reboot command that causes the host to restart and init command

Some common shutdown / restart commands under linux are shutdown, halt, reboot, and init, which can restart the system, but the internal working process of each command is different.

Shutdown

The shutdown command shuts down the system safely, and some users will turn off linux by directly powering off, which is very dangerous. Because linux is different from windows, there are many processes running in the background, so forced shutdown may lead to data loss of processes, make the system in an unstable state, and even damage hardware devices in some systems. Using the shutdown command before the system shuts down, the system administrator will inform all logged-in users that the system is going to shut down. And the login instruction is frozen, meaning that new users can no longer log in. It is possible to shut down the phone directly or delay it for a certain amount of time, and it is also possible to restart it. This is determined by the fact that all processes receive a signal from the system.

Shutdown performs its job by sending signals to the init program asking it to change the runlevel.

Parameter description:

[- t] before changing to another runlevel, tell init how long it will take to shut down.

[- r] restart the calculator.

[- k] doesn't really turn it off, it just sends a warning signal to each login.

[- h] Power off after shutdown (halt)

[- n] instead of init, turn off the phone yourself. The use of this option is discouraged, and the consequences of this option are not always what you expect.

[- c] cancel current process cancels the currently executing shutdown program. So of course there is no time parameter for this option, but you can enter a message to explain and this information will be sent to each user.

[- f] ignore fsck when restarting the calculator (reboot).

[- F] forces fsck when restarting the calculator (reboot).

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

Halt

The simplest shutdown command

Halt is actually a call to shutdown-h. When halt executes, it kills the application process, executes the sync system call, and stops the kernel after the file system write operation is complete.

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 block with an older version of the superblock.

[- w] is not really rebooting or shutting down, just writing wtmp (/ var/log/wtmp) records.

[- d] do not write wtmp records (already included in the option [- n]).

[- f] forced shutdown or restart without calling shutdown.

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

[- p] this option is the default. It is to call poweroff when the computer is turned off.

Reboot

Reboot works much like halt, except that it causes the host to restart and halt shuts down. Its parameters are not much different from those of halt.

Init

Syntax: init (option) (parameter)

Parameter description

-b: enter single-user mode without executing the relevant script

-s: switch to single-user mode.

0 downtime (never set initdefault to 0)

1 single user mode

2 multiple users, no NFS (similar to level 3, some services will be stopped)

3 full multi-user mode

4 is not used

5 x11 (Xwindow)

6 restart (never set initdefault to 6)

Thank you for reading this article carefully. I hope the editor will share what restart commands under Linux are helpful to you. At the same time, I also hope that you will support us, pay attention to the industry information channel, and find out if you encounter problems. Detailed solutions are waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report