在 CentOS 系统中,你可以使用 systemd 来管理启动项。以下是一些常用的方法来查看和管理启动项:
列出所有服务及其状态:
systemctl list-unit-files --type=service
查看已启用的服务:
systemctl list-unit-files --type=service --state=enabled
查看特定服务的状态:
systemctl status <service_name>
查看哪些服务在启动时被禁用:
systemctl list-unit-files --type=service --state=disabled
启用某个服务在启动时自动运行:
systemctl enable <service_name>
禁用某个服务在启动时自动运行:
systemctl disable <service_name>
假设你想禁用一个名为 httpd 的服务(即 Apache HTTP 服务器),可以使用以下命令:
sudo systemctl disable httpd
如果你想重新启用它,则可以运行:
sudo systemctl enable httpd
通过这些步骤,你可以有效地管理和清理 CentOS 系统中的启动项。