How to enable or disable -updates, -security, -backports, -proposed repositories from commandline?
Let's assume that we are using Ubuntu 18.04 LTS (Bionic Beaver).
I know GUI ways to enable or disable the following repositories:
- Important security updates (
bionic-security) - Recommended updates (
bionic-updates) - Pre-released updates (
bionic-proposed) - Unsupported updates (
bionic-backports)
In KDE user may want to open Software & Updates (or software-properties-kde) and navigate to Updates tab.
In GNOME, MATE, Xfce user should open Software & Updates (or software-properties-gtk) and navigate to Updates tab for -security, -updates and -backports and Developer options tab for -proposed.
But how to enable or disable -updates, -security, -backports, -proposed repositories from commandline?
Note: I need a solution without direct editing of /etc/apt/sources.list.
Update: I created discussion and poll named "Does Ubuntu need console alternative for software-properties-gtk / software-properties-kde?" on community.ubuntu.com.
52 Answers
Note: I need a solution without direct editing of
/etc/apt/sources.list.
Would using find and sed to comment out the lines be considered direct editing?
To disable these lines:
find /etc/apt -type f -name '*.list' -exec sed -i 's/\(^deb.*-backports.*\)/#\1/; s/\(^deb.*-updates.*\)/#\1/; s/\(^deb.*-proposed.*\)/#\1/; s/\(^deb.*-security.*\)/#\1/' {} +Alternatively, we can just delete them:
find /etc/apt -type f -name '*.list' -exec sed -i '/-backports/d; /-updates/d; /-proposed/d; /-security/d' {} +To enable them again:
find /etc/apt -type f -name '*.list' -exec sed -i 's/^#\(deb.*-backports.*\)/\1/; s/^#\(deb.*-updates.*\)/\1/; s/^#\(deb.*-proposed.*\)/\1/; s/^#\(deb.*-security.*\)/\1/' {} + Best way to do this is:
sudo nano /etc/apt/sources.listAnd uncomment the lines/sources you need.