Systemd Cheat Sheet
Commands and unit-file syntax for managing services, timers, and system state with systemd on modern Linux distributions.
2 PagesIntermediateFeb 2, 2026
systemctl Basics
Control and inspect services.
bash
systemctl start nginx # Start a service nowsystemctl stop nginx # Stop a servicesystemctl restart nginx # Restart a servicesystemctl reload nginx # Reload config without restartsystemctl enable nginx # Start automatically at bootsystemctl disable nginx # Remove from bootsystemctl status nginx # Show current state and recent logssystemctl is-active nginx # Print active/inactivesystemctl daemon-reload # Reload unit files after editing
Service Unit File
Define a custom long-running service.
ini
# /etc/systemd/system/myapp.service[Unit]Description=My ApplicationAfter=network.target[Service]Type=simpleUser=appuserWorkingDirectory=/opt/myappExecStart=/opt/myapp/bin/start.shRestart=on-failureRestartSec=5Environment=NODE_ENV=production[Install]WantedBy=multi-user.target
Timer Unit (cron alternative)
Schedule a service to run periodically.
ini
# /etc/systemd/system/backup.timer[Timer]OnCalendar=dailyPersistent=true[Install]WantedBy=timers.target# /etc/systemd/system/backup.service[Service]Type=oneshotExecStart=/usr/local/bin/backup.sh# Enable with: systemctl enable --now backup.timer
Logs & Debugging
journalctl and troubleshooting commands.
- journalctl -u nginx- Show logs for a specific unit
- journalctl -u nginx -f- Follow logs in real time (like tail -f)
- journalctl -b- Show logs since the current boot
- journalctl -p err- Filter logs by priority (err, warning, info, etc.)
- systemctl list-units --failed- List all units currently in a failed state
- systemd-analyze blame- Show which units took longest to initialize at boot
Pro Tip
After editing any unit file, always run 'systemctl daemon-reload' before starting/restarting the service — otherwise systemd keeps using the cached in-memory version of the unit.
Was this cheat sheet helpful?
Explore Topics
#Systemd#SystemdCheatSheet#DevOps#Intermediate#SystemctlBasics#ServiceUnitFile#Timer#Unit#CheatSheet#SkillVeris
Advertisement
Sri Hayavadhana Info-Tech
Professional Web Designing Services
- Responsive Websites
- E-commerce Solutions
- SEO Friendly Design
- Fast & Secure
- Support & Maintenance