Linux (Basics Part 2)

Linux Basics Part 2

5. System management

5.1 Processes and Services in Linux

In a computer, a program or command that is being executed is called a "process".
After it is started, a process that exists and resides in memory is generally called a "service".

5.3 systemctl

  • Basic syntax: systemctl start | stop | restart | status service name

5.4 Runlevels

CentOS 6

Insert image description here

There are 7 run levels in Linux systems:Commonly used levels are 3 and 5

  • Run level 0: system shutdown state, system
  • The default run level cannot be set to 0, otherwise it will not start normally.
  • Run level 1: single-user working state, root authority, used for system maintenance, remote login is prohibited
  • Runlevel 2: Multi-user state (no NFS), no network support
  • Run level 3: Complete multi-user state (with NFS), enter console command line mode after logging in
  • Run level 4: System is not in use, reserved
  • Run level 5: X11 console, enter graphical GUI mode after logging in
  • Run level 6: The system shuts down and restarts normally. The default run level cannot be set to 6, otherwise it cannot start normally.

CentOS 7

  • multi-user.target is equivalent to the original run level 3 (multi-user with network, no graphical interface)

  • graphical.target is equivalent to the original run level 5 (multiple users have network and graphical interface)

5.5 Shutdown and restart command

In the Linux field, it is mostly used on servers, and shutdown operations are rarely encountered. After all, there is no end to running a service on the server. Unless under special circumstances, it will be shut down as a last resort.

basic grammar

  • sync

    Function description: Synchronize data from memory to hard disk

    In order to improve the reading and writing efficiency of the disk in the Linux system, "read ahead write later"Operation mode. When a user saves a file, the Linux kernel does not necessarily write the saved data to the physical disk immediately. Instead, it saves the data in the buffer and then writes it to the disk when the buffer is full. This method can be extremely effective. It greatly improves the efficiency of writing data to the disk. However, it also brings security risks. If the system loses power or other serious problems occur before the data is written to the disk, data will be lost.Use the sync command to immediately write the buffer data to disk

  • halt

    Function description: Shutdown, shut down the system, but without interruption of power supply

  • poweroff

    Function description: shutdown, power off

  • reboot

    Function description: It is to restart, equivalent to shutdown -r now

  • shutdown [option] time
    Insert image description here

Guess you like

Origin blog.csdn.net/pipihan21/article/details/132515857