How can I list all the ppa repositories added to my system and save it to a .txt file, so that I don't want to spend my time in searching for ppa's for fresh installations and i can just select a ppa line in my .txt file and append to the command sudo add-apt-repository? Also is there any other ways to do this in which i dont want to give the gpg keys manually?
- 1,025
3 Answers
For those who just want to check the PPAs they have installed without actually doing anything with them automatically you can do:
$ apt-cache policy
In my system, here's a bit of what it shows:
% apt-cache policy
Package files:
100 /var/lib/dpkg/status
release a=now
500 http: ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main Translation-en
500 http: ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main i386 Packages
release v=12.04,o=LP-PPA-ubuntu-toolchain-r-test,a=precise,n=precise,l=Toolchain test builds,c=main
origin ppa.launchpad.net
500 http: ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ precise/main amd64 Packages
release v=12.04,o=LP-PPA-ubuntu-toolchain-r-test,a=precise,n=precise,l=Toolchain test builds,c=main
origin ppa.launchpad.net
500 http: ppa.launchpad.net/rael-gc/scudcloud/ubuntu/ precise/main Translation-en
500 http: ppa.launchpad.net/rael-gc/scudcloud/ubuntu/ precise/main i386 Packages
release v=12.04,o=LP-PPA-rael-gc-scudcloud,a=precise,n=precise,l=ScudCloud - Linux client for Slack,c=main
origin ppa.launchpad.net
...
Quoted from here:
[
apt-cache policy] retrieves priorities associated with each repository resource. From its output, you can infer a list of all available repositories and PPAs.
Source: http://ask.xmodulo.com/list-installed-repositories-ppas-ubuntu.html
- 414
From How can I get a list of all repositories and PPAs from the command line into an install script?
Part of the answer looks to have what you are looking for:
#! /bin/sh
# listppa Script to get all the PPA installed on a system ready to share for reininstall
for APT in `find /etc/apt/ -name \*.list`; do
grep -o "^deb http://ppa.launchpad.net/[a-z0-9\-]\+/[a-z0-9\-]\+" $APT | while read ENTRY ; do
USER=`echo $ENTRY | cut -d/ -f4`
PPA=`echo $ENTRY | cut -d/ -f5`
echo sudo apt-add-repository ppa:$USER/$PPA
done
done
Save this as listppa.sh
listppa.sh > installppa.sh
This creates a script that you can backup somewhere, then run to add your PPAs on a fresh install by simply running:
installppa.sh
- 9,680
From my answer on How can I get a list of all repositories and PPAs from the command line into an install script?
List PPAs in ppa:USER/REPO format:
grep -E '^deb\s' /etc/apt/sources.list /etc/apt/sources.list.d/*.list |\
cut -f2- -d: |\
cut -f2 -d' ' |\
sed -re 's#http://ppa\.launchpad\.net/([^/]+)/([^/]+)(.*?)$#ppa:\1/\2#g' |\
grep '^ppa:'
List all repositories including PPAs in ppa:USER/REPO format:
Just remove the last grep (don't forget to remove the |\ from the previous line after thesed command).
See my answer on the other question for full scripts you can save and use, including generating an install script.
- 213
- 2
- 4