The Basics

The systemctl command on most Linux distributions controls the systemd system and service manager. I’m writing this article to explain systemctl and journalctl. I’ve used [the service command, but it has gone out of style. It’s time for an update.

Without systems, the systemctl and journalctl commands would not exist. The systemd software suite aims to unify service configuration and behavior across systems. It’s worth noting that people dislike systemd because it enables tight couplings between software packages and systemd.

Primary Use Cases

Uncommon and Unsuitable Use Cases

  • A dependency required to run your software

Common Commands

# List all services
sudo systemctl list-units --type service

# List running services
sudo systemctl list-units --type=service --state=running

# List active services
sudo systemctl list-units --type=service --state=active

# List failed services
sudo systemctl list-units --state failed

# Get the status of a service
sudo systemctl status containerd

# Stop a service
sudo systemctl stop containerd

# Start a service
sudo systemctl start containerd

# Restart a service
sudo systemctl restart containerd

# Check if a service is enabled
systemctl is-enabled containerd

# Check if a service is active
sudo systemctl is-active containerd

# Disable a service is active
systemctl disable containerd

# Check service logs for current boot sequence
journalctl -u service-name -b

# Check service logs
journalctl -u containerd

# Tail service logs
journalctl -u containerd -f

Learn systemd - Beyond the Basics


Other Learning