System administration

Linux systemctl command

Inspect or manage systemd services. Service names vary by distribution.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

systemctl [OPTIONS...] COMMAND [UNIT...]

Examples

Inspect the SSH service state (the unit name may vary).

systemctl status ssh

List currently running service units.

systemctl list-units --type=service --state=running

Parameters, options and clauses

Option / clauseDescription
status UNITShow a unit's state and recent log lines.
start UNIT / stop UNITStart or stop a unit now.
restart UNIT / reload UNITRestart a unit or ask it to reload its configuration.
enable UNIT / disable UNITConfigure whether a unit starts at boot.
--nowWith enable/disable, also start/stop the unit immediately.
--userManage the calling user's service manager.
list-units --type=TYPEFilter the list by unit type.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory