← 返回命令列表

Linux command

systemctl 命令

文本

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

常用示例

Example

systemctl status

Example

systemctl --failed

Start/Stop/Restart

systemctl start|stop|restart unit

Enable/Disable

systemctl enable|disable unit

Example

systemctl daemon-reload

Example

systemctl is-active|is-enabled|is-failed unit

Example

systemctl list-units -t service --state running

Example

systemctl cat unit

说明

systemctl controls the systemd system and service manager. It can be used to introspect and control the state of the systemd system, manage services, check unit dependencies, and perform system operations like reboot or shutdown.

参数

-t, --type=TYPE
Filter by unit type (service, socket, target, mount, timer, etc.)
--state=STATE
Filter by unit state (active, inactive, failed, running, etc.)
-a, --all
Show all units including inactive ones
--user
Manage user services instead of system services
--no-block
Return immediately without waiting for operation to complete
--now
Combine enable/disable with start/stop
--force
Override safety checks or symlink conflicts
-q, --quiet
Suppress output
-n, --lines=NUM
Number of journal lines to show with status
--no-pager
Do not pipe output into a pager
-o, --output=FORMAT
Control journal output format (short, verbose, json, etc.)

FAQ

What is the systemctl command used for?

systemctl controls the systemd system and service manager. It can be used to introspect and control the state of the systemd system, manage services, check unit dependencies, and perform system operations like reboot or shutdown.

How do I run a basic systemctl example?

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

What does -t, --type=TYPE do in systemctl?

Filter by unit type (service, socket, target, mount, timer, etc.)