Back to the command reference

systemctl

SystemFundamentalsReference only

Control systemd services

Name: systemctl = systemd control

This command is outside what the site lets you practise (mostly distribution-specific or rarely used tools). This page describes how to use it; try it on your own Linux system.

Description

systemctl is the main tool for systemd: start, stop and restart services, enable them at boot, check their status, and control the system state (power off, reboot, suspend). systemd manages "units"; service units end in .service, which you can usually omit.

Syntax

systemctl [OPTION]... COMMAND [UNIT]...

Common options

start / stopStart / stop a service
restartRestart a service
reloadMake the service reload its configuration without stopping (if it can)
statusShow service status
is-active / is-enabledJust say whether it runs / starts at boot (scripts use the exit status)
enable / disableEnable / disable at boot
--nowWith enable / disable: also start / stop it now
mask / unmaskForbid / allow starting the service at all (stronger than disable)
daemon-reloadMake systemd reread unit files after you edit them
list-unitsList units
list-unit-filesList unit files and whether they start at boot
--failedList only units that failed
--no-pagerPrint straight out, without a pager (for scripts and pipes)

Examples

  • $ sudo systemctl restart nginx

    Restart nginx

    Explain
  • $ systemctl status sshd

    Is the SSH service running?

    Explain
  • $ sudo systemctl enable --now docker

    Enable at boot and start now

    Explain

Related