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. At this point, 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.

正确的关机流程为:sync > shutdown > reboot > halt

关机指令为:shutdown ,你可以man shutdown 来看一下帮助文档。

例如你可以运行如下命令关机:

sync 将数据由内存同步到硬盘中。

shutdown 关机指令,你可以man shutdown 来看一下帮助文档。例如你可以运行如下命令关机:

shutdown h 10 This server will shutdown after 10 mins 这个命令告诉大家,计算机将在10分钟后关机,并且会显示在登陆用户的当前屏幕中。

Shutdown h now 立马关机

Shutdown h 20:25 系统会在今天20:25关机

Shutdown h +10 十分钟后关机

Shutdown r now 系统立马重启

Shutdown r +10 系统十分钟后重启

reboot 就是重启,等同于 shutdown r now

halt 关闭系统,等同于shutdown h now  poweroff

最后总结一下,不管是重启系统还是关闭系统,首先要运行 sync 命令,把内存中的数据写到磁盘中。

关机的命令有 shutdown –h now halt poweroff 和 init 0 , 重启系统的命令有 shutdown –r now reboot init 6









Guess you like

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