← 返回命令列表

Linux command

systemctl-list-units 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Example

systemctl list-units

Example

systemctl list-units -a

Example

systemctl list-units -t [service|socket|timer]

Example

systemctl list-units --state [running|listening|dead]

Example

systemctl list-units '[pattern*]'

Example

systemctl list-units --no-pager

Example

systemctl list-units --no-legend

Example

systemctl list-units --failed

Example

systemctl list-units --full

说明

systemctl list-units displays units that systemd currently has loaded in memory. By default, it shows units that are active, have pending jobs, or have failed. The output shows the unit name, load state, active state, sub-state, and description. This is the primary command for viewing current system state.

参数

-a, --all
Include inactive units and units following other units
-t, --type= _TYPE_
Filter by unit type (comma-separated list, e.g., service, socket, timer)
--state= _STATE_
Filter by LOAD, SUB, or ACTIVE state (comma-separated list)
--failed
Show only failed units (equivalent to --state=failed)
-l, --full
Do not ellipsize unit names, descriptions, or other fields in the output
-r, --recursive
Also show units of local containers
--with-dependencies
Show specified units and their dependencies
--no-pager
Disable pager output
--no-legend
Suppress header and footer (useful for scripts)

FAQ

What is the systemctl-list-units command used for?

systemctl list-units displays units that systemd currently has loaded in memory. By default, it shows units that are active, have pending jobs, or have failed. The output shows the unit name, load state, active state, sub-state, and description. This is the primary command for viewing current system state.

How do I run a basic systemctl-list-units example?

Run `systemctl list-units` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -a, --all do in systemctl-list-units?

Include inactive units and units following other units