Skip to content

Linux & shell: Services & logs (systemd)

6 Linux & shell commands: Services & logs (systemd). Click a command to see what each part does.

Index
6 items
Click a command to see what each part does.

Services & logs (systemd)6

  • systemctl status <unit> --no-pager -lStatus and recent logs of a service

    What each part does

    1. systemctl status <unit>state, PID, last exit code and the last log lines
    2. --no-pagerprint directly instead of opening less
    3. -ldon't truncate long lines
  • sudo systemctl enable --now <unit>Start at boot and start now

    What each part does

    1. enablecreate the links so the unit starts at boot
    2. --nowalso start it right away
  • sudo systemctl daemon-reload && sudo systemctl restart <unit>Reload unit files after editing them

    What each part does

    1. daemon-reloadre-read unit files (does not restart services)
    2. &&only if that worked…
    3. restart <unit>stop then start the service
  • journalctl -u <unit> -f -n 100Follow a service log

    What each part does

    1. -u <unit>only messages from that unit
    2. -ffollow new entries
    3. -n 100start with the last 100 lines
  • journalctl -p err -b --no-pagerErrors since boot

    What each part does

    1. -p errpriority "err" and more severe (crit, alert, emerg)
    2. -bcurrent boot only (-b -1 = previous boot)
    3. --no-pagerplain output
  • journalctl -u <unit> --since "1 hour ago" --until nowLogs in a time window

    What each part does

    1. --sincestart time: absolute ("2026-11-20 10:00") or relative ("1 hour ago", "yesterday")
    2. --untilend time

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…