How can I keep Ubuntu updated automatically?

Introduction

Individual programs do not check for updates in Ubuntu, but there is another method, that works for programs that are installed by default and from the repositories and PPAs. This includes not only snap packages, but all programs except those that you have installed manually from external sources.

See a detailed discussion in a thread at the Ubuntu Forums, particularly (but not only) the following two posts,

  • Post #12
  • Post #13

Livepatch

In Ubuntu 20.04 LTS (the newest LTS release), you get an offer to activate 'Livepatch'. This is offered with a graphical user interface when you log in the first time after installation.

The original task of Livepatch is to patch the kernel on the fly, so that it can be updated without turning off the computer. This can be very valuable for servers, and nice but not necessary for desktop computers. Other update & upgrade tasks have been merged into the software package, that is shown by the small shield-like widget near the top right corner of Ubuntu 20.04 LTS.

I think it will do what you want, to tell you that there are important updates (for security and also other updates), and even to perform the updates automatically, if you wish.

The following screenshot shows what it looks like for me (when active),

enter image description here

When you click on 'Livepatch settings...' you can select what kind of updates you want, as illustrated in the next screenshot,

enter image description here

Sorry for the mixture with some non-English text, but this is in my installed system. 'Program & uppdateringar' means 'Software & Updates'.

Software Updater

In a system, where Livepatch is not activated, you can access 'Software & Updates' from the Settings menu, and you start the Settings menu at the top right corner of the desktop.

In this case a window pops up soon after you boot and log in,

enter image description here

and also from this window you access 'Software & Updates',

enter image description here

This time I can show things in English, which makes it easier to recognize.

Command line method

There is also a rather simple command line method, described in the accepted answer at this very old but still valid link:

  • How can I install just security updates from the command line?

If not installed, run

sudo apt install unattended-upgrades

then do it

sudo unattended-upgrade -d --dry-run
sudo unattended-upgrade -d # Idem --debug

If you want to run it quietly instead:

sudo unattended-upgrade