DevOps & SysadminUpdated: 2026-11-06

Essential Systemctl, Unit Files, Journalctl & Daemon Commands

Quick reference for creating production background daemons, auto-restarting Node.js/Next.js services, and viewing journalctl logs.

Systemd is the standard init system and service manager on modern Linux distributions (Ubuntu, Debian, Fedora, Arch). This reference provides essential systemctl management commands and production unit file templates for running services reliably.

Everyday systemctl Commands

Managing service states and enabling boot-time startups.

TaskCommand SyntaxPurpose
Start Service`sudo systemctl start app`Starts the specified daemon immediately.
Stop Service`sudo systemctl stop app`Gracefully terminates the running process.
Restart Service`sudo systemctl restart app`Stops and restarts the service process.
Enable on Boot`sudo systemctl enable app`Creates symlinks to start service automatically upon system boot.
Check Live Status`systemctl status app`Displays PID, memory usage, uptime, and recent console log lines.
Reload Unit Definitions`sudo systemctl daemon-reload`Must be run after modifying any file in `/etc/systemd/system/`.

Inspecting Logs with journalctl

Querying and streaming centralized systemd journal logs.

Log QueryCommand SyntaxBehavior
Follow Live Logs`journalctl -u app -f`Streams live console output in real time like tail -f.
Last 100 Entries`journalctl -u app -n 100 --no-pager`Prints the most recent 100 log lines without pager navigation.
Errors Since Boot`journalctl -u app -b -p err`Filters for priority error/crit/emerg logs generated in the current boot.

Frequently Asked Questions

Where should custom systemd unit files be placed?

Place custom system administrator unit files in `/etc/systemd/system/app.service` (higher priority than `/lib/systemd/system/`).

Why do changes to a .service file not take effect immediately?

Systemd caches unit definitions in memory. You must run `sudo systemctl daemon-reload` before restarting the modified service.