Linux-logout-shutdown-reboot

Source: Internet
Author: User
Linux-logout-shutdown-reboot-Linux general technology-Linux technology and application information. For details, refer to the following section. 1. log out, shut down, and restart

Log out of the system's logout command

1. Logout is a relative logon operation. After logging on to the system, if you want to leave the system, you only need to issue the logout command directly:

[Root @ localhost root] # logout

Red Hat Linuxrelease 9 (Shike)

Kernel 2.4.20.8 on an i686

Login: logging back to the Login screen

2. shutdown or restart the shutdown command

The Shutdown command can shut down all programs and restart or shut down as needed.

Parameters are described as follows:

? Immediate shutdown: The-h Parameter causes the system to shut down immediately. Example:

[Root @ localhost root] # shutdown? H now require the system to shut down immediately

? Specify the shutdown time: the time parameter can specify the shutdown time; or set the time to run the shutdown command. The example is as follows:

[Root @ localhost root] # shutdown now restart immediate shutdown

[Root @ localhost root] # shutdown + 5 minutes later shutdown

[Root @ localhost root] # shutdown at else shutdown

? Automatically Restart after Shutdown:-r parameter settings shut down and then restart. Example:

[Root @ localhost root] # shutdown-r now restart immediately shut down the system and restart

[Root @ localhost root] # shutdown-r restart specifies to restart

3. restart the computer's reboot command.

As the name implies, the reboot command is used to restart the system. Common parameters are as follows:

? -F parameter: Shut down the system and restart the computer without running the program normally.

? -I parameter: Close all network interfaces before restarting.

Although the reboot command can be used as a parameter, you only need to run the reboot command separately.

Bytes -------------------------------------------------------------------------------------------------------------------------
Common shutdown and restart commands in Linux include shutdown, halt, reboot, and init, which can be used for shutdown and restart. However, the internal working process of each command is different, next we will introduce them one by one.

1. shutdown

The shutdown command is used to safely shut down the Linux system. It is very dangerous for some users to disable Linux by directly disconnecting the power supply. Because Linux and Windows run many processes in the background, forced shutdown may lead to data loss in the process, making the system unstable and even damaging hardware devices.

When the shutdown command is executed, the system notifies all logged-on users that the system will be shut down and the login Command will be frozen. That is, new users cannot log on to the system. You can use the shutdown command to directly shut down the system, delay the specified time before shutting down the system, and restart the system. If the system is shut down after a specified delay, the user can have time to store the files being processed and to close the opened programs.

Some parameters of the shutdown command are as follows:

[-T] specifies how long the system will be shut down

[-R] restart the system

[-K] does not actually shut down, but sends a warning signal to every logged-on user.

[-H] Shut down the system (halt)

The job of the shutdown command is to send a signal to the init program and require it to switch the Runlevel of the system ). The system running level includes:

0: Shut down the system

1: in single-user mode, if the-h or-r parameter is not specified for the shutdown command, the system will switch to this running level by default.

2: multi-user mode (NFS not supported)

3: multi-user mode (supporting NFS), which is usually used

5: multi-user mode (GUI Mode)

6. restart the system.

2. halt

Halt is the simplest shutdown command. It actually calls the shutdown-h command. When halt is executed, the application process is killed. After the file system writes, the kernel is stopped.

Some parameters of the halt command are as follows:

[-F] Force shutdown or restart without calling shutdown

[-I] disable all network interfaces before shutting down or restarting

[-P] poweroff is called upon shutdown. This option is the default option.

3. reboot

The reboot process is similar to that of halt. Its function is to restart and halt is to shut down. Its parameters are similar to those of halt.

4. init

Init is the ancestor of all processes, and its Process number is always 1. Init is used to switch the running level of the system. The switchover is completed immediately. The init 0 command is used to immediately switch the system running level to 0, that is, shutdown. The init 6 command is used to switch the system running level to 6, that is, restart.
Related Article

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.