HxHippy

systemctl

Control the systemd system and service manager

Overview

Used to introspect and control the state of the systemd system and service manager. Start, stop, restart, enable, and disable system services.

Syntax

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

Common Options

--user

Talk to the service manager of the calling user.

-t, --type=TYPE

Filter units by type (e.g., service, socket, target).

--state=STATE

Filter units by load state, sub state, or overall state.

-a, --all

Show all loaded units regardless of their state.

--no-pager

Do not pipe output into a pager.

-l, --full

Do not ellipsize unit names on output.

Examples

$ systemctl status nginx

Show the status of the nginx service.

$ sudo systemctl start nginx

Start the nginx service.

$ sudo systemctl stop nginx

Stop the nginx service.

$ sudo systemctl restart nginx

Restart the nginx service.

$ sudo systemctl reload nginx

Reload nginx configuration without stopping the service.

$ sudo systemctl enable nginx

Enable nginx to start on boot.

$ sudo systemctl disable nginx

Disable nginx from starting on boot.

$ systemctl is-active nginx

Check if nginx is currently running.

$ systemctl is-enabled nginx

Check if nginx is enabled to start on boot.

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

List all running services.

$ systemctl list-unit-files --type=service

List all service unit files and their enablement state.

$ systemctl daemon-reload

Reload systemd manager configuration (after editing unit files).

$ systemctl cat nginx.service

Show the unit file for nginx.

systemctlsystemdservicedaemonunitenabledisablestartstopstatus