Daily Linux Server Management

Essential tasks and commands for maintaining a healthy Linux server

System Health Check

System Resources
Running Processes

Check System Resources

Monitor CPU, memory, and disk usage:

# Check memory usage
free -h
# Check disk usage
df -h
# Check CPU usage (interactive)
top
# Alternative to top
htop

Monitor Running Processes

Identify resource-intensive processes:

# Show processes sorted by CPU usage
ps aux --sort=-%cpu | head -10
# Show processes sorted by memory usage
ps aux --sort=-%mem | head -10
# Real-time process monitoring
top
# Find processes by name
pgrep -l nginx
Tip: Set up monitoring tools like Nagios, Zabbix, or Prometheus for automated health checks.

Security Monitoring

Check for Unauthorized Access

Review authentication logs and open connections:

# Check failed login attempts
grep "authentication failure" /var/log/auth.log
# Check successful logins
grep "Accepted password" /var/log/auth.log
# Check current connections
netstat -tunap
ss -tunap
# Check sudo commands
grep sudo /var/log/auth.log

Firewall Status

# Check UFW status
ufw status
# Check iptables rules
iptables -L -n -v
# Check open ports
netstat -tuln
ss -tuln
Important: Regularly review security logs and investigate any suspicious activity.

Service Management

Check Critical Services

Ensure essential services are running:

# Check service status systemctl status nginx
systemctl status mysql
systemctl status apache2
# List all running services
systemctl list-units --type=service --state=running
# Check if service is enabled on boot
systemctl is-enabled nginx

Service Management Commands

# Restart a servicebr> systemctl restart nginx
# Stop a servicebr>
systemctl stop nginx
# Start a servicebr>
systemctl start nginx
# Enable service on bootbr>
systemctl enable nginx
# Reload service configuration
systemctl reload nginx
Note: Use reload instead of restart when possible to avoid downtime.

Backup Verification

Check Backup Status

Ensure backups are running successfully:

# Check backup logs
tail -n 20 /var/log/backup.log
# Verify backup file integrity
sha256sum /backup/server-backup.tar.gz
# Check backup disk space
df -h /backup
# List recent backups
ls -la /backup

Test Restoration Process

Periodically verify backups can be restored:

# Extract test file from backup
tar -tzf /backup/server-backup.tar.gz | head -10
# Test restore to temporary location
mkdir /tmp/restore-test
tar -xzf /backup/server-backup.tar.gz -C /tmp/restore-test --strip-components=1 ./important-file.txt
Warning: Backups are useless if they can't be restored. Test regularly!

Log Management

Review System Logs

Check for errors and warnings:

# Check system messages
tail -n 50 /var/log/syslog
# Check authentication logs
tail -n 50 /var/log/auth.log
# Check application logs
tail -n 50 /var/log/nginx/error.log
tail -n 50 /var/log/mysql/error.log
# Search for errors in logs
grep -i error /var/log/syslog | tail -n 20

Log Rotation

Ensure logs are being rotated properly:

# Check logrotate status logrotate --debug /etc/logrotate.conf
# Force log rotation
logrotate -f /etc/logrotate.conf
# Check disk usage of logs
du -sh /var/log/
# Find large log files
find /var/log -type f -size +100M
Tip: Set up log aggregation with tools like ELK Stack or Graylog for better log management.

Daily Checklist

Essential Daily Tasks

  • Check system resource usage
  • Review security logs
  • Verify backup completion
  • Check critical services
  • Review application logs
  • Check disk space
  • Update package lists
  • Check for security updates

Completion: 0%

Weekly Tasks

  • Apply security updates
  • Clean up temporary files
  • Review user accounts
  • Verify firewall rules
  • Test backup restoration

Package Management

Update Package Lists

# Ubuntu/Debian apt update
# CentOS/RHEL
yum check-update
# Fedora
dnf check-update

Check for Updates

# Ubuntu/Debian
apt list --upgradable
# CentOS/RHEL
yum list updates
# Fedora
dnf list updates

Security Updates

# Ubuntu/Debian (security updates only)
unattended-upgrade --dry-run
# Check for security updates
apt list --upgradable | grep -i security
Note: Test updates in a staging environment before applying to production.

Interactive Terminal

user@server:~$ # Welcome to the Linux server management guide
Select a command from below to simulate output
Note: This is a simulation. No actual commands are being executed.

← Back to ServerMgmt Index ↑ Back to EXPANDED