Menu Close
13.3. 列出系统服务
您可以列出所有当前载入的服务单元以及所有可用服务单元的状态。
流程
要列出所有当前载入的服务单元,请输入:
$ systemctl list-units --type service
UNIT LOAD ACTIVE SUB DESCRIPTION abrt-ccpp.service loaded active exited Install ABRT coredump hook abrt-oops.service loaded active running ABRT kernel log watcher abrtd.service loaded active running ABRT Automated Bug Reporting Tool ---- systemd-vconsole-setup.service loaded active exited Setup Virtual Console tog-pegasus.service loaded active running OpenPegasus CIM Server LOAD = Reflects whether the unit definition was properly loaded. ACTIVE = The high-level unit activation state, i.e. generalization of SUB. SUB = The low-level unit activation state, values depend on unit type. 46 loaded units listed. Pass --all to see loaded but inactive units, too. To show all installed unit files use 'systemctl list-unit-files'默认情况下,
systemctl list-units
命令只显示活跃的单位。对于每个服务单元文件,命令会显示:-
UNIT
:其全名 -
LOAD
:是否载入了单元文件的信息 -
ACTIVE
\SUB
:其高级别和低级单元文件激活状态 -
DESCRIPTION
: 一个较短的描述信息
-
要列出所有载入的单元,而不考虑其状态,使用
--all
或-a
命令行选项输入以下命令:$ systemctl list-units --type service --all
要列出所有可用服务单元的状态(启用/禁用),请输入:
$ systemctl list-unit-files --type service
UNIT FILE STATE abrt-ccpp.service enabled abrt-oops.service enabled abrtd.service enabled ... wpa_supplicant.service disabled ypbind.service disabled 208 unit files listed.对于每个服务单元,这个命令会显示:
-
UNIT FILE
:其全名 -
STATE
:是否启用或禁用服务单元
-
其他资源