Tool cheatsheet
systemd and journalctl Cheatsheet
Manage services, read logs, schedule timers and write unit files on Linux systems that use systemd.
Managing services
- Check a service — Show whether a service is running, with its latest log lines.
- Start a service — Start a service right now.
- Stop a service — Stop a running service right now.
- Restart a service — Stop and start a service.
- Reload a service's configuration — Ask a service to reload its configuration without restarting, if it supports that.
- Start a service now and at boot — Enable a service for boot and start it immediately.
- Stop starting a service at boot — Disable a service from starting at boot. Add --now to also stop it.
- Test if a service is running — Print active or inactive; the exit code suits scripts.
- List failed units — Show units that have failed.
- List running services — Show all service units that are loaded and running.
- Prevent a service from starting — Link the unit to /dev/null so nothing can start it, even manually.
- Manage your own user services — Use the per-user service manager, with no sudo.
Logs with journalctl
- Show a service's logs — Show all log entries for a unit.
- Follow a service's logs — Stream new log entries as they arrive.
- Show recent entries only — Show entries from the last hour.
- Show errors from this boot — Show messages of priority error and worse since the last boot.
- Show the previous boot's logs — Read logs from the boot before this one, for example after a crash.
- Show kernel messages — Show kernel log entries, like dmesg.
- Show the latest lines — Show the last 100 lines without paging.
- Check how much space logs use — Show the disk space used by the journal.
- Delete old logs — Remove journal entries older than seven days.
Unit files and timers
- Write a service unit — A service that runs an app as its own user and restarts it on failure. Save it as /etc/systemd/system/myapp.service.
- Reload unit files — Make systemd re-read unit files after you create or change one.
- Override a unit safely — Create a drop-in override file instead of editing the packaged unit.
- Show a unit's effective definition — Print the unit file and its drop-ins.
- Write a timer — Run a service every day at 03:00, and catch up after downtime. Pair it with a myjob.service.
- List timers — Show timers with their next and last run times.
- Check a unit file for errors — Check a unit file for mistakes.
- Test a calendar expression — Show when an OnCalendar expression will next fire.
- Keep user services running after logout — Let a user's services start at boot and keep running without a login session.
System info and boot analysis
- See what slows boot — List units by how long they took to start.
- Show the boot critical path — Show the chain of units that determined boot time.
- Show or set the hostname — Show the hostname and OS details. Set one with hostnamectl set-hostname.
- Show the date, time and timezone — Show time settings and whether the clock is synchronized.
- Set the timezone — Change the system timezone.
Related cheatsheets
- Ansible 2 cheatsheet — Run ad-hoc commands and playbooks, manage inventories, roles, collections and secrets with Ansible.
- Argo CD 3 cheatsheet — Install Argo CD, define Applications declaratively, and manage sync, diffs, history and rollbacks with the argocd CLI.
- AWS CLI 2 cheatsheet — Configure credentials and manage S3, EC2, Lambda, logs, containers and secrets with the AWS CLI v2.
- Azure CLI 2 cheatsheet — Sign in and manage resource groups, VMs, web apps, storage, Kubernetes, registries and secrets with the az command.
- Bash and Linux 5 cheatsheet — Everyday shell and Linux commands for files, searching text, permissions, processes and servers.
- Claude API cheatsheet — Call Claude from Python, TypeScript or curl: messages, streaming, thinking, tools, structured output, caching, batches and error handling.