$ command-helper

systemd (systemctl, journalctl)

Managing services, reading logs with journalctl, writing your own unit and timers.

Requires Google sign-in

Services

Service status
systemctl status <service>
Start, stop, restart
sudo systemctl restart <service>

Same form for start and stop.

Reload config without restart
sudo systemctl reload <service>
Enable on boot and start now
sudo systemctl enable --now <service>
Disable autostart
sudo systemctl disable <service>
Failed services
systemctl --failed
All running services
systemctl list-units --type=service --state=running

Logs (journalctl)

Follow a service's logs
journalctl -u <service> -f
Logs since the last hour
journalctl -u <service> --since "1 hour ago"
Logs of the current boot, errors only
journalctl -b -p err
Kernel messages
journalctl -k
How much space the journal usesadvanced
journalctl --disk-usage
Shrink the journal to 500 MBadvanced
sudo journalctl --vacuum-size=500M

Unit files

Show a unit's file
systemctl cat <service>
Override settings without editing the original
sudo systemctl edit <service>
Reload unit files after changes
sudo systemctl daemon-reload
Minimal service unitadvanced
# /etc/systemd/system/<service>.service
[Unit]
Description=My app
After=network.target

[Service]
ExecStart=/usr/bin/node /opt/app/server.js
Restart=on-failure
User=app
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
List timers (systemd's cron)advanced
systemctl list-timers
Boot time breakdownadvanced
systemd-analyze blame