systemd Basics
Managing services with systemd.
Service Management
Start service
sudo systemctl start nginx
Stop service
sudo systemctl stop nginx
Restart service
sudo systemctl restart nginx
Reload configuration
sudo systemctl reload nginx
Service status
systemctl status nginx
Enable & Disable
Enable on boot
sudo systemctl enable nginx
Disable on boot
sudo systemctl disable nginx
Check if enabled
systemctl is-enabled nginx
Check if active
systemctl is-active nginx
Listing Services
List all services
systemctl list-units --type=service
List running services
systemctl list-units --type=service --state=running
List failed services
systemctl list-units --state=failed
Logs
View service logs
journalctl -u nginx
Follow logs
journalctl -u nginx -f
Show last N lines
journalctl -u nginx -n 50
Since time
journalctl --since today