How to Keep Linux Updated and Secure
Learn how to update your Linux system, enable automatic security updates, and set up a basic firewall.
Prerequisites
- A Linux distribution installed (Ubuntu, Debian, Mint, etc.)
Update from the terminal
The most reliable way to update your system. apt update refreshes the list of available packages, and apt upgrade installs the new versions.
sudo apt update && sudo apt upgrade
Update from the GUI
Don't want to use the terminal? Most distros have a graphical updater:
- Ubuntu: Software Updater (opens automatically when updates are available)
- Linux Mint: Update Manager (lives in the system tray)
- Pop!_OS: Settings → OS Upgrade & Recovery
Click the notification or open the updater from the app menu.
Enable automatic security updates
Let your system install critical security patches automatically in the background. This only applies to security updates — not app upgrades.
sudo apt install unattended-upgrades sudo dpkg-reconfigure --priority=low unattended-upgrades
Clean up old packages
Over time, unused packages and old kernels pile up. Clean them periodically to free space.
sudo apt autoremove sudo apt autoclean
Set up a basic firewall
UFW (Uncomplicated Firewall) is a simple firewall that comes with Ubuntu. Enable it to block unwanted incoming connections while allowing your normal internet use.
sudo ufw enable sudo ufw status # Allow SSH if you need remote access: sudo ufw allow ssh
Update Flatpak and Snap apps
Flatpak and Snap apps update separately from your system packages. Snaps update automatically, but you can trigger it manually. Flatpak needs a manual command.
# Update all Flatpak apps: flatpak update # Update all Snap apps: sudo snap refresh