Linux Basics: Checking Services and Logs
On Debian and Ubuntu systems running systemd, systemctl shows service status and journalctl reads system logs. These checks are a useful starting point when a background service is not working.
Find running services
systemctl list-units --type=service --state=running --no-pager
systemctl --failed --no-pagerThe first command lists services currently running. The second lists units in a failed state. --no-pager prints the output directly instead of opening a scrolling viewer.
A service can be stopped intentionally. An inactive service is not automatically a problem.
Inspect one service
systemctl status cron.service --no-pagerThis example checks the traditional cron scheduler. Replace cron.service with a service name from your own system. If cron is not installed, a message saying the unit could not be found is expected.
Look at the Active line and recent messages. active (running) means the service is running. active (exited) can be normal for a service that finishes a one-time task.
Read recent logs
journalctl -u cron.service -n 30 --no-pager-u selects a unit, and -n 30 shows up to 30 recent entries. If access is restricted, an authorized administrator can run the same command with sudo.
An empty result can mean there are no retained entries or you cannot access them.
Some containers and WSL setups do not run systemd as their init system. These commands may be unavailable or unable to connect there.
References
systemctl manual · journalctl manual
Acknowledgements
This post was created with assistance from AI.
Linux Basics — lesson 18 of 25. Series index
Previous: Checking Running Processes · Next: Inspecting Network Addresses and Ports