systemd commands
26 commands, each with a one-line explanation. Click a command to copy it, or its title for details.
Commands 26 shown
-
systemctl enable --now myapp.serviceEnable at boot and start immediately in one command
-
systemctl list-units --state=failedList all units that are in a failed state
-
systemctl daemon-reload && systemctl restart myapp.serviceReload unit definitions and restart the service
-
systemctl edit myapp.serviceCreate /etc/systemd/system/myapp.service.d/override.conf with partial overrides
-
systemctl cat myapp.servicePrint the full unit file including drop-ins
-
systemd-analyze blame | head -20Show top 20 units by initialization time
-
systemd-analyze dot --require | dot -Tsvg > boot.svg && open boot.svgRender full boot dependency graph as SVG
-
cat > /etc/systemd/system/myapp.service <<EOF [Unit] Description=My App After=network.target [Service] ExecStart=/usr/bin/myapp Restart=always RestartSec=5 User=appuser [Install] WantedBy=multi-user.target EOFMinimal systemd service unit template
-
systemd-run --uid=1000 --gid=1000 --wait /usr/bin/myapp --taskRun a transient one-shot unit under a specific user
-
cat > /etc/systemd/system/backup.timer <<EOF [Unit] Description=Daily backup [Timer] OnCalendar=daily Persistent=true [Install] WantedBy=timers.target EOFReplacement for cron with Persistent=true for missed runs
-
systemctl set-property myapp.service MemoryMax=512M CPUQuota=50%Apply cgroup limits without editing unit file
-
systemctl status myapp.service | grep -E 'Memory:|CPU:|Tasks:'Current memory, CPU, and task counts from cgroup
-
systemctl list-units --type=socket --allAll socket-activated units and their state
-
systemctl mask snapd.servicePrevent a service from being started by anything
-
systemctl show myapp.service -p EnvironmentPrint environment variables injected into the service
-
systemd-analyze critical-chain <unit>Show the serialized dependency chain that actually delays boot; more honest than blame
-
systemd-analyze plot > boot.svgRender full parallel boot timeline as an SVG to spot serialized stalls visually
-
systemctl edit <unit> # writes /etc/systemd/system/<unit>.d/override.confPatch a unit via drop-in without touching the vendor file; use --full to fork the whole unit
-
systemctl daemon-reloadReload unit files after editing; note: required after manual edits or systemctl warns of stale config
-
systemctl mask <unit> && systemctl unmask <unit>Mask symlinks a unit to /dev/null so it cannot start even as a dependency; stronger than disable
-
systemctl list-dependencies <unit> --allWalk the full Wants/Requires tree to debug why a service pulls in others; --reverse for who needs it
-
systemctl show -p MainPID,MemoryCurrent,TasksCurrent <unit>Read live cgroup metrics straight from systemd without ps; MemoryCurrent is the accounted RSS
-
systemctl reset-failed && systemctl list-units --state=failedReset failed counters so units can restart past StartLimitBurst, then list what is still failed
-
systemd-run --on-calendar='*-*-* 03:00:00' --unit=backup /usr/local/bin/backup.shSpin up a throwaway timer+service without writing unit files; great for ad-hoc scheduled jobs
-
systemctl set-property --runtime <unit> MemoryMax=512M CPUQuota=50%Apply cgroup limits live without restart; --runtime keeps them volatile (gone on reboot)
-
systemctl list-jobsShow in-flight start/stop jobs to diagnose a hung boot or a unit stuck activating
no commands match — try a different search