5

Lets imagine I have a added a repository called ppa:something/amazing, but I have forgotten what the PPA was all about and the name of the PPA is too vague or the PPA is a very large one. I want to check what it is without using an internet browser and going to the Launchpad website. Is there a way to view information about the PPA from the command line? I am mainly interested viewing a list of the packages contained in the PPA.

2
  • Software center >> Edit >> source sources >> Other software – Srinivas Gowda Feb 24 '13 at 21:34
  • @SrinivasGowda I am looking for a command-line way... also, that doesn't show the list of packages anyway. – pileofrocks Feb 24 '13 at 21:40
3

Here is a shell script based on this answer:

#!/bin/bash

if [ $# -eq 1 ]; then
    CMD=s
    PPA=$1  
else
    CMD=$1
    PPA=$2
fi

case "$CMD" in
"-f" | "f")
    cat $(echo "$PPA"|sed -e 's!/!_!' -e 's!^ppa:!/var/lib/apt/lists/ppa.launchpad.net_!' -e 's!$!_ubuntu_dists_'$(lsb_release -sc)'_main_binary-'$(dpkg --print-architecture)'_Packages!') | less
    ;;
"-s" | "s")
    cat $(echo "$PPA"|sed -e 's!/!_!' -e 's!^ppa:!/var/lib/apt/lists/ppa.launchpad.net_!' -e 's!$!_ubuntu_dists_'$(lsb_release -sc)'_main_binary-'$(dpkg --print-architecture)'_Packages!') | grep 'Package:' | sed 's/Package: //'
    ;;
*)
    echo "Usage: $0 [mode] PPA"
    echo ""
    echo "mode:"
    echo "  -f:  Displays detailed information about each package in the PPA"
    echo "  -s:  Displays only the names of the packages in the PPA"
    ;;
esac

Save this to a file, such as ppa-info, and make sure it is located within the system path and is executable.

When you run this with just the name of a PPA (or the option -s), it will simply print a list of the names of all the packages in the PPA. However, if you run it with the option -f, it will print detailed information about all the packages in the PPA, just as in the original answer.

0
4

Assuming you have the package list downloaded (apt-get update will do that) you could see there what packages are available for your distribution from that PPA.

If you want some shell code this should do the trick:

PPA=ppa:something/amazing
less $(echo "$PPA"|sed -e 's!/!_!' -e 's!^ppa:!/var/lib/apt/lists/ppa.launchpad.net_!' -e 's!$!_ubuntu_dists_'$(lsb_release -sc)'_main_binary-'$(dpkg --print-architecture)'_Packages!')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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