How to use systemctl to manage system services in CentOS?

In CentOS, the systemctl command is used to manage system services. Here are some commonly used systemctl commands:

  1. Start a service.
sudo systemctl start <service_name>
  1. Stop a service.
sudo systemctl stop <service_name>
  1. Restart a service.
sudo systemctl restart <service_name>
  1. Reload configuration file.
sudo systemctl reload <service_name>
  1. Check service status.
sudo systemctl status <service_name>
  1. Enable a service to automatically start when the system boots up.
sudo systemctl enable <service_name>
  1. Disable a service so that it does not start automatically when the system boots up.
sudo systemctl disable <service_name>
  1. View all enabled services.
sudo systemctl list-unit-files --state=enabled
  1. View all running services.
sudo systemctl list-units --type=service

These are some commonly used systemctl commands that can help you manage various services in your CentOS system.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds