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