Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I list all packages I've installed from a particular PPA? Command-line answers preferred.

Related question: how can I list all installed packages that are not available from the main Ubuntu archives, and also see which repositories they came from? (If I knew the answer to this question, I could grep that list for a particular PPA name to find out the answer to my first question.)

share|improve this question
    
Since there doesn't seem to be an existing command-line tool for this (sadly), I'll accept one of the GUI answers. –  Marius Gedminas Oct 15 '10 at 0:07
add comment

4 Answers 4

up vote 19 down vote accepted

Simply expand the "Installed Software" item in Ubuntu Software Center. You'll see a list of all the different repositories that you've enabled. Clicking on the repo will show you the packages you've installed from each.

alt text

share|improve this answer
    
I'm afraid that option is only available in Ubuntu 10.10 or am I missing something? My Software Center doesn't display sources below that menu. –  lovinglinux Oct 11 '10 at 15:17
add comment

There seems to be no record of the origin of an installed package.

If you are fine with getting the location from whence a package of the same name would be downloaded from, this is available through apt-cache policy. The following (rather ugly) script does the trick for me:

LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' \
  | fgrep ':install ok installed' \
  | cut -d: -f1 \
  | (while read pkg; do 
       inst_version=$(apt-cache policy $pkg \
                                | fgrep Installed: \
                                | awk '{ print $2 }'); 
       origin=$(apt-cache policy "$pkg" \
                          | fgrep " *** ${inst_version}" -C1 \
                          | tail -n 1 \
                          | cut -c12-); 
       echo $pkg $origin; 
     done)

Note that it's quite fragile, as it makes assumptions about the output of apt-cache policy, which might change across versions...

share|improve this answer
    
Yeah, this would basically mean writing a tool from scratch. And I think parsing /var/lib/apt/lists with Perl or Python would be faster and more robust. –  Marius Gedminas Oct 15 '10 at 0:07
add comment

Open Synaptic Package Manager and click the "Origin" button on the left sidebar. It will list your sources. Select a source to see the available/installed packages.

share|improve this answer
add comment

Under Quantal (12.10), the space in the origin line needs to be removed.

LC_ALL=C dpkg-query --showformat='${Package}:${Status}\n' -W '*' \
 | fgrep ':install ok installed' \
 | cut -d: -f1 \
 | (while read pkg; do 
   inst_version=$(apt-cache policy $pkg \
                            | fgrep Installed: \
                            | cut -d: -f2-); 
   origin=$(apt-cache policy "$pkg" \
                      | fgrep " ***${inst_version}" -C1 \
                      | tail -n 1 \
                      | cut -c12-); 
   echo $pkg $origin; 
 done)
share|improve this answer
add comment

Your Answer

 
discard

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.