Updates
Chapter 13 — Keeping Linux Healthy
A Linux system that is well maintained stays fast, stable, and secure for years. Neglect it — let updates pile up, disk space fill to the brim, logs balloon unchecked — and small problems compound into big ones. This final chapter covers the four pillars of desktop Linux maintenance: updates, disk space, logs, and backups.
1. Keeping the System Updated
Updates deliver security patches, bug fixes, and new features. On a Linux desktop you should run a full update at least once a week — more often if you're running a system exposed to the internet.
Full update routine — Ubuntu / Debian / Mint
Full update routine — Fedora
apt upgrade only upgrades
packages that don't require removing or installing additional packages.
apt full-upgrade (formerly dist-upgrade) also handles packages
that need dependency changes — necessary for kernel updates. For daily use,
upgrade is fine. Run full-upgrade weekly to catch kernel
and library updates.
Checking for and applying kernel updates
unattended-upgrades pre-installed. It automatically applies security-only
updates in the background. You can check its configuration at
/etc/apt/apt.conf.d/50unattended-upgrades. It's a good safety net, but
it doesn't replace doing a full upgrade manually — it only handles security patches,
not all available updates.
Upgrading to a new distro version
Ubuntu releases a new LTS version every two years. When a new LTS is available, you'll see a notification in the Software Updater. You can also upgrade from the terminal:
2. Managing Disk Space
A full disk is one of the most disruptive things that can happen to a Linux system — applications crash, logs stop writing, and in some cases the desktop itself freezes. Check disk usage regularly and clean up before you run out of space.
Checking disk usage
Here's what healthy vs warning disk usage looks like for your root partition (/):
Freeing up disk space
apt remove, apt purge, and apt autoremove instead —
they cleanly handle all the dependencies.
GUI tools for disk space
- Disk Usage Analyzer (Baobab) —
sudo apt install baobab— treemap view of where your space is being used. Excellent for finding unexpected large files visually. - BleachBit —
sudo apt install bleachbit— cleans browser caches, temp files, and more. Run without root for user files, with root for system files. - ncdu —
sudo apt install ncdu— terminal-based interactive disk usage browser. Fast and works over SSH.
3. Reading and Managing Log Files
Linux keeps detailed records of what the system and its services are doing. These logs
are invaluable when something goes wrong — they tell you exactly what happened and when.
Modern Linux uses systemd journal for most logging, supplemented by
traditional plain-text log files in /var/log/.
The systemd journal — journalctl
Traditional log files in /var/log/
dmesg. Useful for hardware detection issues at startup.Limiting journal size permanently
By default the journal has no hard size limit. To prevent it growing indefinitely,
edit /etc/systemd/journald.conf and add or uncomment these lines:
4. Quick System Health Checks
A handful of commands give you a snapshot of how the system is doing right now:
uptime are the system load averaged over the last 1, 5, and 15 minutes.
A value of 1.0 on a single-core machine means 100% CPU use. On a 4-core machine, values
below 4.0 are fine. Values consistently above your core count mean the system is
overloaded and processes are queuing for CPU time.
5. Backup Strategies
Linux makes it easy to lose data — rm has no Recycle Bin, and a command
like sudo dd to the wrong device can wipe a disk instantly. A backup is
your safety net for both accidents and hardware failure. The golden rule is
3-2-1: three copies, on two different media types, with one copy offsite
(or in the cloud).
Built-in to GNOME as "Backups". Backs up your home directory to a USB drive or cloud storage (Google Drive, Nextcloud). Scheduled automatic backups with encryption. Best option for beginners.
Snapshots the system (not personal files) using rsync or BTRFS snapshots. Like Windows System Restore — useful for rolling back after a bad update or config change. Pre-installed on Linux Mint.
Powerful, flexible tool that synchronises files to another location. Only transfers changed files, making subsequent backups fast. Excellent for scripting and scheduling with cron. Available by default on most distros.
Modern backup tool with deduplication and encryption built in. Backs up to local disk, SSH server, S3, Backblaze B2, and more. Excellent for offsite cloud backups where you don't want the cloud provider to see your files.
A basic rsync backup script
Scheduling backups with cron
cron is the Linux task scheduler — it runs commands at set times
without you having to do anything. Edit your cron schedule with crontab -e:
Cron uses a five-field time format: minute hour day month weekday
| Cron entry | What it does |
|---|---|
| 0 2 * * * /path/to/backup.sh | Run backup script every day at 2:00 AM |
| 0 3 * * 0 rsync -avh ~/Documents/ /mnt/usb/ | rsync every Sunday at 3:00 AM |
| */30 * * * * /usr/bin/my-check.sh | Run a script every 30 minutes |
| 0 9 1 * * /usr/bin/monthly-report.sh | Run on the 1st of every month at 9:00 AM |
| @reboot /home/philip/startup.sh | Run once at every system startup |
crontab -l to list your current
scheduled jobs without editing. If you're not sure your cron syntax is correct, the
website crontab.guru lets you type a cron expression and see in plain
English exactly when it will run.
What to back up
- Always:
~/— your home directory contains all personal files, browser profiles, application config (~/.config,~/.local), SSH keys (~/.ssh), and shell history (~/.bashrc) - If you have a server:
/etc/(all configuration files),/var/www/(web content), database dumps (usemysqldumpfor MySQL) - Less critical:
/usr/local/(manually installed software) — most of this can be reinstalled - Not worth backing up:
/tmp,/proc,/sys,/dev— these are virtual or temporary and should not be included in backups
6. Monthly Maintenance Checklist
- Run a full system update —
sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y && flatpak update -y - Check disk space —
df -h. If root is above 80%, investigate withncdu ~andsudo apt clean - Verify backups ran — check Déjà Dup history, or
ls -lh /mnt/backup/if using rsync manually. Test that you can restore a file - Review failed services —
systemctl --failed. Investigate and restart or remove anything that shouldn't be failing - Check for errors in logs —
journalctl -p err -b --no-pager | head -30 - Clean the journal —
sudo journalctl --vacuum-time=4weeksif you haven't set a permanent limit - Reboot — especially after kernel updates. Clears memory, applies the new kernel, and reveals any boot issues in a controlled moment rather than unexpectedly
- Check Timeshift snapshots (if using) — ensure a recent snapshot exists before any major update or change
- Review UFW rules —
sudo ufw status verbose. Remove rules for services you no longer run - Check for suspicious login attempts —
sudo grep "Failed password" /var/log/auth.log | tail -20
Chapter Summary
| Topic | Key commands and tools |
|---|---|
| System updates | sudo apt update && sudo apt full-upgrade -y && sudo apt autoremove -y weekly. flatpak update -y for Flatpak apps. Reboot after kernel updates. |
| Disk space | df -h — overview. du -sh ~/path/ — size of a directory. ncdu ~ — interactive browser. sudo apt clean && sudo apt autoremove — reclaim space from package cache and old dependencies. |
| Logs | journalctl -b (this boot), journalctl -f (live tail), journalctl -u service (one service), journalctl -p err (errors only). Traditional files in /var/log/. Vacuum with --vacuum-time. |
| Health checks | uptime (load average), free -h (memory), systemctl --failed (broken services), htop (interactive CPU/memory). smartctl -H /dev/sda for disk health. |
| Backups | Déjà Dup (GUI, home directory). Timeshift (system snapshots, rollback). rsync -avh --delete src/ dest/ (scriptable, fast). Restic (encrypted, offsite cloud). Schedule with crontab -e. |