linux 查看安装的服务
时间: 2023-10-24 16:00:15 浏览: 40
在 Linux 中,可以使用以下命令来查看已安装的服务:
1. systemctl 命令
systemctl 是 Linux 系统中管理服务的主要命令,可以用它来查看、启动、停止、重启、启用、禁用系统服务。以下是一些常用的 systemctl 命令:
- 查看所有已安装的服务:`systemctl list-unit-files --type=service`
- 查看所有正在运行的服务:`systemctl list-units --type=service`
- 查看指定服务的状态:`systemctl status 服务名称`
- 启动服务:`sudo systemctl start 服务名称`
- 停止服务:`sudo systemctl stop 服务名称`
- 重启服务:`sudo systemctl restart 服务名称`
- 启用服务:`sudo systemctl enable 服务名称`
- 禁用服务:`sudo systemctl disable 服务名称`
2. service 命令
service 命令是一种更为传统的管理服务的方式,在一些 Linux 系统中可能会使用它。以下是一些常用的 service 命令:
- 查看所有已安装的服务:`service --status-all`
- 查看指定服务的状态:`service 服务名称 status`
- 启动服务:`sudo service 服务名称 start`
- 停止服务:`sudo service 服务名称 stop`
- 重启服务:`sudo service 服务名称 restart`
希望以上命令能够帮助你查看已安装的服务。