


Detailed introduction to systemctl command in Linux
Linux Systemctl is a collection of system management daemons, tools and libraries used to replace the System V, service and chkconfig commands. The initial process is mainly responsible for controlling the systemd system and service manager. Through Systemctl –help, you can see that the command is mainly divided into: querying or sending control commands to the systemd service, commands for management unit services, commands related to service files, commands related to tasks, environments, and snapshots, configuration reloading of systemd services, and system Commands related to powering on and off.
1. List all available units
# systemctl list-unit-files
2. List all running units
# systemctl list-units
3. List all failed units
# systemctl –failed
4. Check whether a certain unit (such as crond.service) is enabled
##
# systemctl is-enabled crond.service
5. List all Service
# systemctl list-unit-files –type=service
6. How to start, restart, stop, reload services and check the status of services (such as httpd.service) in Linux
# systemctl start httpd.service # systemctl restart httpd.service # systemctl stop httpd.service # systemctl reload httpd.service # systemctl status httpd.service
7. How to activate the service and enable or disable the service at boot (that is, the mysql.service service is automatically started when the system starts)
# systemctl is-active mysql.service # systemctl enable mysql.service # systemctl disable mysql.service
8. How to block (so that it cannot be started) or display services (such as ntpdate.service)
# systemctl mask ntpdate.service ln -s ‘/dev/null”/etc/systemd/system/ntpdate.service' # systemctl unmask ntpdate.service rm ‘/etc/systemd/system/ntpdate.service'
9. Use the systemctl command to kill the service
# systemctl kill crond
10. List all system mount points
# systemctl list-unit-files –type=mount
11. Mount, unmount, remount, reload the system mount point and check the mount point status in the system
# systemctl start tmp.mount # systemctl stop tmp.mount # systemctl restart tmp.mount # systemctl reload tmp.mount # systemctl status tmp.mount
12. Activate, enable or disable mount points at startup (automatically mounted at system startup)
# systemctl is-active tmp.mount # systemctl enable tmp.mount # systemctl disable tmp.mount
13. Mask (so that it cannot be enabled) or visible mount points in Linux
# systemctl mask tmp.mount ln -s ‘/dev/null”/etc/systemd/system/tmp.mount' # systemctl unmask tmp.mount rm ‘/etc/systemd/system/tmp.mount'
14. List all available system sockets
# systemctl list-unit-files –type=socket
15. Check all Configuration details
# systemctl show mysql
16. Get the dependency list of a service (httpd)
# systemctl list-dependencies httpd.service
17. Start rescue mode
# systemctl rescue
18. Enter emergency mode
# systemctl emergency
19. List the currently used runlevels
# systemctl get-default
20. Start running level 5, that is, graphics mode
# systemctl isolate runlevel5.target
# systemctl isolate graphical.target
21. Start running level 3, that is, multi-user mode (command line)
# systemctl isolate runlevel3.target
# systemctl isolate multiuser.target
22. Set multi-user mode or graphics mode as the default running level
# systemctl set-default runlevel3.target # systemctl set-default runlevel5.target
23. Restart, stop, suspend, hibernate or put the system into hybrid sleep
##
# systemctl reboot # systemctl halt # systemctl suspend # systemctl hibernate # systemctl hybrid-sleep
For those who don’t know what run level is, here’s the explanation. Runlevel 0: Shut down the system
Runlevel 1: Rescue, maintenance mode
Runlevel 3: Multi-user, no graphical system
Runlevel 4: Multi-user, no graphical system
Runlevel 5: Multi-user , Graphical system
Runlevel 6: Shut down and restart the machine
The above is the detailed content of Detailed introduction to systemctl command in Linux. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

VS Code system requirements: Operating system: Windows 10 and above, macOS 10.12 and above, Linux distribution processor: minimum 1.6 GHz, recommended 2.0 GHz and above memory: minimum 512 MB, recommended 4 GB and above storage space: minimum 250 MB, recommended 1 GB and above other requirements: stable network connection, Xorg/Wayland (Linux)

The five basic components of the Linux system are: 1. Kernel, 2. System library, 3. System utilities, 4. Graphical user interface, 5. Applications. The kernel manages hardware resources, the system library provides precompiled functions, system utilities are used for system management, the GUI provides visual interaction, and applications use these components to implement functions.

Although Notepad cannot run Java code directly, it can be achieved by using other tools: using the command line compiler (javac) to generate a bytecode file (filename.class). Use the Java interpreter (java) to interpret bytecode, execute the code, and output the result.

vscode built-in terminal is a development tool that allows running commands and scripts within the editor to simplify the development process. How to use vscode terminal: Open the terminal with the shortcut key (Ctrl/Cmd). Enter a command or run the script. Use hotkeys (such as Ctrl L to clear the terminal). Change the working directory (such as the cd command). Advanced features include debug mode, automatic code snippet completion, and interactive command history.

To view the Git repository address, perform the following steps: 1. Open the command line and navigate to the repository directory; 2. Run the "git remote -v" command; 3. View the repository name in the output and its corresponding address.

The reasons for the installation of VS Code extensions may be: network instability, insufficient permissions, system compatibility issues, VS Code version is too old, antivirus software or firewall interference. By checking network connections, permissions, log files, updating VS Code, disabling security software, and restarting VS Code or computers, you can gradually troubleshoot and resolve issues.

Writing code in Visual Studio Code (VSCode) is simple and easy to use. Just install VSCode, create a project, select a language, create a file, write code, save and run it. The advantages of VSCode include cross-platform, free and open source, powerful features, rich extensions, and lightweight and fast.

VS Code is available on Mac. It has powerful extensions, Git integration, terminal and debugger, and also offers a wealth of setup options. However, for particularly large projects or highly professional development, VS Code may have performance or functional limitations.
