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
- Managing services on Unix systems
- Container manager interface
Less Suitable 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
Related Content
- How to List Services in Linux
- Linux: Why do people hate systemd?
- Create a simple systemd service unit file and run a script on boot
Other Learning
- How Do I Learn Effectively?
- Learn 3D Graphics
- Learn Amazon Athena
- Learn Asymptotic Notations
- Learn AWS Amplify
- Learn Color Theory
- Learn Data Visualization
- Learn Design Systems
- Learn ECS
- Learn GitHub
- Learn How To Prioritize
- Learn Java
- Learn Java Coding Challenges
- Learn JavaScript
- Learn jq
- Learn Kubernetes
- Learn Python
- Learn Rendanheyi
- Learn SignalFx
- Learn Software Architecture
- Learn Software Design Patterns
- Learn Structurizr
- Learn systemd
- Learn Terraform