The article directories

  • 1. Specify a run level
    • 1.1 Basic Introduction
    • 1.2 Application Examples
    • 1.3 Operating Levels of CentOS7

1. Specify a run level

1.1 Basic Introduction

Runlevel description:

  • 0: turn it off
  • 1: single user [retrieve lost password]
  • 2: no network service is available in the multi-user state
  • 3: The network service is available in the multi-user state
  • 4: The system is not in use
  • 5: Graphical interface
  • 6: The system restarts

Common runlevels are 3 and 5, but you can also specify a default runlevel.

1.2 Application Examples

  • Command:init [0123456]Application case: PassinitTo switch between different runlevels, such as action5-3“And turn it off.

1.3 Operating Levels of CentOS7

  • Prior to centos7, the configuration run level was in/etc/inittabIn the file
  • Centos7 has been simplified as follows:
multi-user.target: analogous to runlevel 3
graphical.target: analogous to runlevel 5
Copy the code
  • Explanation:
multi-user.target is equivalent to init3The level graphical. Target is equivalent to init5levelCopy the code
  • To view current default target (view current run level), run (run) :
systemctl get-default
Copy the code

  • To set a default target, run:
systemctl set-default TARGET.target
Copy the code
  • Switching to a graphical interface (Init 5 runlevel) :
systemctl set-default graphical.target
Copy the code
  • After restarting the system based on the above runlevel switch, it will still enter the terminal interface of Init 3, and will not enter the graphical interface again