Services
This guide covers the management of system services in Linux, focusing on systemd, the most common init system.
🔄 Service Management Basics
Systemctl Commands
# View service status
systemctl status service_name # Check service status
systemctl is-active service_name # Check if service is running
systemctl is-enabled service_name # Check if service starts at boot
# Control services
systemctl start service_name # Start a service
systemctl stop service_name # Stop a service
systemctl restart service_name # Restart a service
systemctl reload service_name # Reload configuration
systemctl enable service_name # Enable service at boot
systemctl disable service_name # Disable service at bootCommon Service Operations
# View all services
systemctl list-units --type=service # List running services
systemctl list-units --type=service --all # List all services
systemctl list-unit-files --type=service # List service files
# View service logs
journalctl -u service_name # View service logs
journalctl -u service_name -f # Follow service logs
journalctl -u service_name --since today # Today's logs📝 Service Configuration
Service Unit Files
Creating Custom Services
Reload System Configuration
🔍 Service Monitoring
System Journal
Resource Usage
🛠️ Service Troubleshooting
Common Issues
Debug Mode
💡 Best Practices
Service Management
Always check status after changes
Use reload instead of restart when possible
Keep service files organized
Document custom services
Monitoring
Set up log rotation
Monitor resource usage
Configure alerts for failures
Regular status checks
Security
Run services with minimal privileges
Use secure file permissions
Implement rate limiting
Regular security audits
🔒 Security Considerations
Service Hardening
Access Control
📊 Common Services Reference
Web Servers
Databases
Network Services
Timezone
Show currently set timezone
Search timezones
Set timezone
Firewall
To show firewall status
Set firewall port to public
Reload firewall
See firewall public rules
Last updated
Was this helpful?