Ubuntu offers an easy GUI interface that allows you to edit, (de-)activate and remove PPAs.
But going through all the GUI dialogs and menus can sometimes be tedious, especially if you have a lot of PPAs added to your system.
That's why I was wondering if there was a way to disable (and enable) a PPA from the command-line.
Note: I am not talking about adding/removing the PPA (that's quite easy to do: sudo add-apt-repository ppa
/ sudo add-apt-repository --remove ppa
). What I am looking for is a way to temporarily disable a PPA and reenable it at will – all from within the CLI.
Edit:
Sushantp606 and Davidson Chua's answers were a good starting point and made me change the scope of my question. It's certainly good to know that repositories can be managed with the sources.list
files but this still looks like a very tedious task to me. I would love to know if there is a way to automate this in the same manner the Software Properties window does.
Ideally I would like to find a command that will make it possible to quickly enable and disable a PPA by its PPA address, e.g.:
ppa_activate ppa:synapse-core/ppa
and
ppa_deactivate ppa:synapse-core/ppa
Best Answer
Even a simpler script to toggle between activating or deactivating a particular ppa. Save the code given below in a file, for instance
toggle_ppa.sh
.Follow the procedure given at the other answer to keep file in PATH and make it executable.
Usage
Example
How it works
The working principle of this code is the same as in my other answer. The code acts in a very interactive manner. When someone runs this along with ppa name as its argument, it will display the PPA's current status and what the code is going to do on successful execution. Then it will ask permission of the user. Only if the user inputs
'y'
to confirm the code will change the status of the PPA and activate/deactivate it. It will immediately abort if the user puts an'n'
for no.