systemd Cheatsheet
Top commands.
Overview
systemd is the init system and service manager underneath every modern Linux distribution. Five primitive surfaces cover almost everything an operator does day-to-day: systemctl for service control, unit files for declarative config, dependency directives for startup ordering, timers for scheduled jobs, and resource limits for protection. Fluency in all five turns ad-hoc init scripts into reviewable service definitions.
- Service management via
systemctl.start,stop,restart,status,enable. The verbs every Linux operator uses dozens of times a day. - Unit files in
/etc/systemd/system. Declarative service config that lives in source control alongside the application. - Dependency directives.
Wants,Requires,After,Beforeexpress startup ordering without shell hacks. - Timers plus resource limits.
systemdtimers replace cron with traceable, journalled jobs;CPUQuota,MemoryMax,IOWeightcontain runaway services.
The approach
Five commands carry most operational weight. Memorising them moves the team from cargo-culted shell snippets to confident service control.
systemctl status app. Live status plus the last lines of journal output. The first command on every service issue.systemctl restart app. Clean restart that respects unit-file dependencies. Replaces ad-hockill -HUPpatterns.systemctl enable --now app. Enable at boot and start immediately, in one command.systemctl daemon-reloadpluslist-timers. Reload after unit-file edits to avoid stale config;list-timersshows what is actually scheduled.
Why this compounds
Each unit file captures service knowledge in a reviewable format. Over the year, the team's service library becomes a working map of how the platform actually starts up; debugging starts from a definition, not a guess.
- Reproducible services. Unit files produce identical behaviour across hosts. Drift shrinks.
- Faster debugging.
journalctlplussystemctl statusanswers most service questions in seconds. - Resource protection. CPU, memory, and IO limits stop one bad service from taking the host down.
- Year-one investment, year-two habit. The first year builds fluency under pressure. By year two, writing a unit file is routine.