Centos 7中如何确定运行个服务的名称

How to determine names of running services in Centos 7

必须在不同的 Linux 发行版上管理一些生产服务器,我发现很难记住 restart/stop 服务的确切名称。 有没有系统的方法来确定 运行ning 服务的名称,然后能够 运行

service <service name> status/stop/reload/start

命令?

通常,在后台执行任务的程序通常被称为“服务”和“守护进程”。

我们可以使用"service"或"systemctl"来管理这些服务。 例子: -服务服务名称开始 -systemctl 启动服务名称

大部分自定义服务文件位于“/etc/init.d/”目录,自定义 systemd 文件位于“/etc/systemd/system/”目录

centos 7 使用

systemctl list-unit-files