Include a remove-apt-repository ?

Asked by Loofy


I was thinking maybe this could be a good thing to have? Also an easy way of removing a certain repository?

The command then needs to display what you have installed from that particular repository. And optionally if you want to remove it during the removal of the repository.

Best Regards
Fredrik L

Question information

English Edit question
Ubuntu software-properties Edit question
No assignee Edit question
Solved by:
Mark Rijckenberg
Last query:
Last reply:
Revision history for this message
Best Mark Rijckenberg (markrijckenberg) said :

Here is more information:

sudo add-apt-repository --help
sudo: unable to resolve host new-host-2
Usage: add-apt-repository <sourceline>

add-apt-repository is a script for adding apt sources.list entries.
It can be used to add any repository and also provides a shorthand
syntax for adding a Launchpad PPA (Personal Package Archive)

<sourceline> - The apt repository source line to add. This is one of:
  a complete apt line in quotes,
  a repo url and areas in quotes (areas defaults to 'main')
  a PPA shortcut.
  a distro component

    apt-add-repository 'deb http://myserver/path/to/repo stable myrepo'
    apt-add-repository 'http://myserver/path/to/repo myrepo'
    apt-add-repository ' free non-free'
    apt-add-repository ppa:user/repository
    apt-add-repository multiverse

If --remove is given the tool will remove the given sourceline from your

  -h, --help show this help message and exit
  -m, --massive-debug Print a lot of debug information to the command line
  -r, --remove remove repository from sources.list.d directory
  -k KEYSERVER, --keyserver=KEYSERVER
                        URL of keyserver. Default:
  -y, --yes Assume yes to all queries

You can use the add-apt-repository in combination with the following command

find /etc/apt -name '*.list' -exec bash -c 'echo -e "\n$1\n"; cat -n "$1"' _ '{}' \;

to determine which repositories you want to delete.

Your arguments are valid and so I suggest contacting Chow Loong Jin <email address hidden>

I hope Chow Loong Jin is still working on it.

Revision history for this message
Mark Rijckenberg (markrijckenberg) said :

I also suggest posting your suggestion here:

Revision history for this message
Loofy (loofy) said :


Great! Even better already implemented.. Just me not reading the manual sorry for that. :)

I will note the brainstorm url.


Best Regards
Fredrik L

Revision history for this message
Loofy (loofy) said :

Thanks Mark Rijckenberg, that solved my question.