Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I add a PPA and I want to install some of its content, it is quite annoying to re-update all my apt list using apt-get update.

Is it instead possible to only sync the content of a given repository?

share|improve this question
Starting from wily, you could just use add-apt-repository -u – Treviño Jul 17 '15 at 22:34
There is no -u on Ubuntu (15.x) Vivid as far as I can tell. – kenorb Nov 14 '15 at 19:53
@Treviño It isn't mentioned in the Wily manpage:… Is it documented elsewhere? – muru Feb 11 at 20:26
@muru I think that has to be fixed, it's only mentioned on add-apt-repository --help. Please open a bug asking to fix the manpage. – Treviño Feb 19 at 0:26
up vote 64 down vote accepted

yes, apt-get can do that, and can do it in a nice way.

  1. Append following to ~/.bash_funcs

    update-repo() {
        for source in "$@"; do
            sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/${source}" \
            -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"    
  2. Append following to ~/.bashrc

    if [ -f $HOME/.bash_funcs ]; then
    .  $HOME/.bash_funcs
  3. Append following to ~/.bash_completion

    # Debian user-defined completion                             -*- shell-script -*-
        local cur
        _init_completion || return
        COMPREPLY=( $( find /etc/apt/sources.list.d/ -name "*$cur*.list" \
    -exec basename {} \; 2> /dev/null ) )
        return 0
    } &&
    complete -F _ppa_lists update-repo
  4. Then source the files

    . ~/.bashrc
    . ~/.bash_completion
  5. Done and start to fire it

    update-repo <tab> <tab>

You can update a single ppa repository without having to update whole apt source, with implement of bash-completion.

share|improve this answer
+1 For Reminding me I know nothing about bash. – Behrooz Sep 21 '13 at 16:21
You should package this. – PyRulez Apr 24 '14 at 19:44
Are you sure the autocompletion script is working? – qed Jun 5 '14 at 15:33
When I hit Tab it shows update-repo _init_completion: command not found – Vinu Kevy Mar 13 '15 at 17:38
FYI: I've used the knowledge I gained from this post to propose an option to add-apt-repository to do this automatically.… – Jay _silly_evarlast_ Wren May 30 '15 at 0:50

If the repository is configured in a specific file in the directory /etc/apt/sources.list.d/, say myrepo.list, you can update that single repository with the command:

sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/myrepo.list" \
    -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

Nevertheless this is not very convenient.
This can be simplified defining a bash function

update_repo() {
    sudo apt-get update -o Dir::Etc::sourcelist="sources.list.d/$1.list" \
        -o Dir::Etc::sourceparts="-" -o APT::Get::List-Cleanup="0"

so that you can simply run

update_repo myrepo
share|improve this answer
I've checked this again, but it doesn't work if then you want to install a package that has some unresolved dependency on another repository (also in the main archive) – Treviño Nov 13 '11 at 19:25

Y PPA Manager comes with a command line tool called update-ppa that lets you update a single PPA.

For example:

sudo update-ppa ppa:nilarimogard/webupd8

Also, when adding a PPA through Y PPA Manager, the PPA source is automatically updated (only for that PPA). In a future version, there's going to be a GUI to manually update single PPAs as well.

More information about Y PPA Manager, HERE.

share|improve this answer
sudo add-apt-repository ppa:webupd8team/y-ppa-manager then sudo apt-get update and finally sudo apt-get install y-ppa-manager – mchid Nov 8 '14 at 5:16

To update a specific repository, use -o, e.g.:

apt-get update -o Dir::Etc::sourcelist=/path/to/repo.list

Here is a one-liner updating only recently added apt repository

find /etc/apt/sources.list.d -type f -name '*.list' -exec sudo apt-get update -o Dir::Etc::sourcelist="{}" ';'

It's much quicker than updating all repositories, especially during VM provisioning after adding new.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.