Use of systemctl command in Linux system

Use of systemctl command

The systemctl command can be used to control the service. The service command and the chkconfig command can still be used, but mainly for compatibility reasons, they should be avoided as much as possible.

When using the systemctl command, the extension of the service name can be written in full, for example:

systemctl stop name.service

You can also ignore:

systemctl stop name

systemctl commonly used commands

Start service
systemctl start name.service

Close service   
systemctl stop name.service

Restart service   
systemctl restar tname.service

Only when the service is running, restart the service   
systemctl try-restart name.service

Reload service configuration file   
systemctl relaod name.service

Check service operation status
systemctl status name.service

or

systemctl is-active name.service

Show all service status details

systemctl list-units --type service --all

Allow service to start   
systemctl enable name.service

Prohibit service startup   
systemctl disable name.service

Check the startup status of the service

systemctl status name.service

or

systemctl is-enabled name.service

List all services and check if they are started

systemctl list-unit-files --type service

Use the following command to list services:

By default, only active services are listed. If you want to see all services, use the -all or -a parameter:
systemctl list-units --type service
systemctl list-units --type service --all

Sometimes you want to see so you can set the startup service, use the following command:

systemctl list-unit-files --type service

To view the service details, use the following command:

systemctl status name.service

Guess you like

Origin blog.csdn.net/qq_39599464/article/details/114871153