How do you use apt-get to only install critical security updates on ubuntu?

I read the apt-get man page carefully when I got tired of manually editing the sources.list every time I wanted to only apply security updates (that means the second time).

Figured this solution out:

sudo cp /etc/apt/sources.list /etc/apt/security.sources.list

Edit the latter to contain only security repositories, then:

sudo apt-get upgrade -o Dir::Etc::SourceList=/etc/apt/security.sources.list

Tadaaaa... Scriptable stuff.


Try the unattended-upgrades or any of the other methods listed here. It can be used to configure automatic security updates (I believe it's used when asked during the installer) as well as other upgrades automatically. See the man pages for more details.