Controlling services on Linux keeps maintenance predictable during configuration changes, upgrades, and incident response. Reliable start, stop, restart, and reload actions reduce downtime and make recovery steps repeatable.

Most modern distributions run background processes as systemd units, and systemctl communicates with the systemd manager to control them. Service units are commonly named name.service, with unit files typically stored under /usr/lib/systemd/system (distribution packages) and /etc/systemd/system (local overrides and custom units).

Reloading is preferred when a daemon supports it because configuration is re-read without a full process teardown, but many units do not implement reload. Restarting interrupts active work and can disconnect clients, so validating the unit state and recent logs before and after changes helps prevent avoidable outages.

Steps to manage a Linux service with systemctl:

  1. List installed service unit files to confirm the unit name.
    $ systemctl list-unit-files --type=service | head -n 8
    UNIT FILE                                    STATE           PRESET
    accounts-daemon.service                      enabled         enabled
    alsa-restore.service                         static          -
    alsa-state.service                           static          -
    alsa-utils.service                           masked          enabled
    anacron.service                              enabled         enabled
    apparmor.service                             enabled         enabled
    apport-autoreport.service                    static          -

    systemctl accepts both service-name and service-name.service.

  2. Check the current service state from the status output.
    $ sudo systemctl status --no-pager --full example.service | head -n 14
    * example.service - Example API
         Loaded: loaded (/etc/systemd/system/example.service; enabled; preset: enabled)
         Active: active (running) since Sat 2026-01-10 07:19:57 +08; 29s ago
       Main PID: 149762 (python3)
          Tasks: 1 (limit: 4546)
         Memory: 9.1M (peak: 9.3M)
            CPU: 52ms
         CGroup: /system.slice/example.service
                 - 149762 /usr/bin/python3 -m http.server 9000 --bind 127.0.0.1
    
    Jan 10 07:19:57 host.example.net systemd[1]: Started example.service - Example API.

    The bottom section shows recent log lines for the unit.

  3. Start the service.
    $ sudo systemctl start example.service
  4. Stop the service.
    $ sudo systemctl stop example.service

    Stopping a shared dependency can take down other services that require it.

  5. Reload the service configuration when the unit supports reload.
    $ sudo systemctl reload example.service
    Failed to reload example.service: Job type reload is not applicable for unit example.service.

    Use reload-or-restart when a reload is preferred but not guaranteed: sudo systemctl reload-or-restart service-name.

  6. Restart the service to reinitialize the process.
    $ sudo systemctl restart example.service

    A restart drops existing connections and can abort in-flight work.

  7. Reload systemd unit definitions after creating or editing a unit file.
    $ sudo systemctl daemon-reload

    Required after changes under /etc/systemd/system. No services are restarted by this command.

  8. Enable the service to start at boot.
    $ sudo systemctl enable example.service
    Created symlink /etc/systemd/system/multi-user.target.wants/example.service -> /etc/systemd/system/example.service.

    Use --now to start immediately during enablement: sudo systemctl enable --now service-name.

  9. Disable the service from starting at boot.
    $ sudo systemctl disable example.service
    Removed "/etc/systemd/system/multi-user.target.wants/example.service".

    Use --now to stop immediately during disablement: sudo systemctl disable --now service-name.

  10. Confirm whether a service is active without the full status output.
    $ systemctl is-active example.service
    active

    Common states include active, inactive, and failed.

  11. Confirm whether a service is enabled at boot without the full status output.
    $ systemctl is-enabled example.service
    enabled

    Common states include enabled, disabled, static, and masked.