Linux system startup status and shutdown

Linux  system boot process

When linux starts, we will see a lot of boot messages.

The startup process of the Linux system is not as complicated as you think. The process can be divided into 5 stages:

  • Booting of the kernel.
  • run init.
  • system initialization.
  • Create a terminal.
  • User logs in to the system.

Type of init program:

  • SysV:  init, before CentOS 5, configuration file: /etc/inittab.
  • Upstart:  init, CentOS 6, configuration files: /etc/inittab, /etc/init/*.conf.
  • Systemd:  systemd, CentOS 7, configuration files: /usr/lib/systemd/system, /etc/systemd/syste

Generally speaking, there are three ways for users to log in:

  • (1) Command line login
  • (2) SSH login
  • (3) Graphical interface login

Switching between graphics mode and text mode

The Linux preset provides six command window terminals for us to log in to.

By default, we log in to the first window, which is tty1. The six windows are tty1, tty2 ... tty6. You can press Ctrl + Alt + F1 ~ F6 to switch between them.

If you have the GUI installed, you will enter the GUI by default, and you can press Ctrl + Alt + F1 ~ F6 to enter one of the command window interfaces.

When you enter the command window interface and then return to the graphical interface, just press Ctrl + Alt + F7 to come back.

If you are using a vmware virtual machine, the shortcut keys for switching the command window are Alt + Space + F1~F6. If you are in the graphical interface, please press Alt + Shift + Ctrl + F1~F6 to switch to the command window.



Linux shutdown

In the field of linux, it is mostly used on servers and rarely encounters shutdown operations. After all, there is no end to running a service on the server, and it will be shut down unless it has to be under special circumstances.

The correct shutdown process is: sync > shutdown > reboot > halt

The shutdown command is: shutdown, you can check the help document by man shutdown.

For example, you can run the following command to shutdown:

sync synchronizes data from memory to hard disk.

shutdown shutdown command, you can man shutdown to see the help document. For example, you can run the following command to shutdown:

shutdown - h 10 ' This server will shutdown after 10 mins ' This command tells everyone that the computer will be shut down after 10 minutes and will be displayed on the current screen of the logged in user.  

Shutdown h now shuts down immediately 

Shutdown h 20 : 25The system will shut down at 20 : 25 today  

Shutdown h + 10 to shut down after ten minutes  

Shutdown r now system restarts immediately 

Shutdown r + 10 system reboots after ten minutes  

reboot is restart, equivalent to shutdown r now

Halt shuts down the system, equivalent to shutdown h now and poweroff

Finally, to sum up, whether you restart the system or shut down the system, you must first run  the sync  command to write the data in memory to the disk.

The shutdown commands include  shutdown -h now halt poweroff  and  init 0  , and the system restart commands include  shutdown -r now reboot init 6 .









Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325505428&siteId=291194637