System Maintenance Guide

Best practices to keep your Linux system optimized and secure

System Updates

Regular Updates

$ sudo apt update && sudo apt upgrade -y # Debian/Ubuntu$ sudo dnf upgrade --refresh # Fedora$ sudo pacman -Syu # Arch

Kernel Updates

$ sudo apt install linux-generic # Ubuntu LTS$ sudo dnf kernel-upgrade # Fedora

Cleanup

Remove Old Packages

$ sudo apt autoremove --purge # Debian$ sudo dnf autoremove # Fedora$ sudo pacman -Rns $(pacman -Qtdq) # Arch

Clear Cache

$ sudo journalctl vacuum-time=2weeks$ sudo rm -rf ~/.cache/*

Backups

System Backup

$ sudo timeshift --create # Snapshot$ sudo deja-dup --backup # GUI Tool

File Backup

$ rsync -avh --progress /source /destination$ tar -czvf backup.tar.gz /path/to/folder

Security

Firewall

$ sudo ufw enable # Ubuntu$ sudo firewall-cmd --reload # Fedora

Virus Scan

$ sudo freshclam # Update ClamAV$ sudo clamscan -r /home

Hardware

Disk Health

$ sudo smartctl -a /dev/sda$ sudo badblocks -v /dev/sda

Memory Test

$ sudo memtester 500M 1

Logs & Monitoring

Journal Logs

$ journalctl -p 3 -xb # Errors$ journalctl --disk-usage

System Monitoring

$ htop # Process viewer$ nmon # Performance monitor

🔧 Maintenance Pro Tips

Automation

Use cron jobs for regular maintenance:0 3 * * * apt update && apt upgrade -y

Scheduling

Monthly tasks:

  • Full system backup
  • Disk defragmentation
  • Security audit