How to remove repository on Ubuntu command line. On Ubuntu, remove repository from apt via command line. Ubuntu users can remove ppa and packages; remove repository from apt and from sources list.
Using apt-get to remove PPA
On Linux Ubuntu Systems, apt-get is the command-line tool for handling packages, and works as the user’s “back-end” to other tools using the APT library.
For removing or deleting PPA or packages, the following apt-get options are used:
- remove: remove is identical to install except that packages are removed instead of installed. Note that removing a package leaves its configuration files on the system. If a plus sign is appended to the package name (with no intervening space), the identified package will be installed instead of removed.
- purge: purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
- autoremove (and the auto-remove alias since 1.1): autoremove is used to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed.
Whenever we add a repository using ‘add-apt-repository’ command, it is stored in /etc/apt/sources.list file. However, if we add PPA repositories, we will have to examine /etc/apt/sources.list.d/ directory and delete the respective entry.
Ubuntu – Remove repository from apt
Run the following command to remove repository from apt:
sudo add-apt-repository --remove ppa:PPA_Name/ppa
Ubuntu – Remove repository from sources list
To remove the repository from sources list, first run the command to see all the PPAs added in the system. Use the following command:
ls /etc/apt/sources.list.d
Now look for the PPA you wish to remove/delete and then remove the .list file associated with the PPA using the following command:
sudo rm -i /etc/apt/sources.list.d/PPA_Name.list
Remove a PPA by using ppa-purge in the terminal
On Ubuntu, the PPA purge utility is not preinstalled. Type the showing command to install it:
sudo apt-get purge
Once installed, remove a PPA using ppa-purge command:
sudo ppa-purge ppa:<ppa-file>
Once the removal/deletion is completed, don’t forget to update the system.