systemctl so you can see how systemd services behave in real time and how to manage them in production environments. We’ll switch to the root user to avoid repeatedly typing sudo during the demo.

sshd service (example output shown):
Loaded: where the unit file comes from and its enablement status.Active: the runtime state (e.g.,active (running),inactive (dead)).- Trailing journal-like lines: recent log messages from the service (systemd journal).
- Start a service:
systemctl start <service> - Stop a service:
systemctl stop <service> - Restart a service (stop then start):
systemctl restart <service> - Reload service config (if supported):
systemctl reload <service> - Try reload, fall back to restart:
systemctl reload-or-restart <service>
sshd and then check its status:
sshd again:
systemctl restart <service>: performs a full stop and start. Use when a full restart is acceptable (there will be downtime).systemctl reload <service>: asks the service to reload its configuration without stopping. Only works if the unit implements a reload action.systemctl reload-or-restart <service>: preferred in automation — it attemptsreloadand falls back torestartif reload is not supported.
Prefer
reload when the service supports it to avoid downtime. If reload is not implemented, use restart or reload-or-restart to attempt a seamless update with a fallback.systemctl enable <service>: create the boot-time symlink so the service starts automatically.systemctl disable <service>: remove the boot-time symlink so the service does not start at boot.systemctl is-active <service>: returnsactive,inactive, etc. — useful in scripts.systemctl is-enabled <service>: returnsenabled,disabled, etc. — useful in scripts.systemctl list-units --type=service --state=active: list active services; remove--state=activeto broaden the list.
Masking and unmasking services
- Masking creates a symlink from the unit file path to
/dev/null, preventing the unit from being started manually or as a dependency. - To start a masked service you must first
unmaskit.
systemctl daemon-reload so systemd re-reads unit definitions.
Further reading and references
- systemd man pages:
man systemd,man systemctl - OpenSSH:
man sshd,man sshd_config - Official systemd documentation: https://www.freedesktop.org/wiki/Software/systemd/ and https://www.freedesktop.org/software/systemd/man/systemctl.html
systemctl and managing services in real time.