6

While doing some support audits I'd like to know what would be the most efficient/compact way to get a list of all extra reporitories being used on a given Ubuntu workstation using command line (not via the GUI tools). So far I am using:

  • diff'ing a standard sources.list file against the workstation's
  • examining files under cat /etc/apt/sources.list.d

Any other ideas on how to best go about this ?

4 Answers 4

3

To examine the files under /etc/apt/sources.list.d, you could use:

cat /etc/apt/sources.list.d/*.list | grep -v "^#"

This reads out the contents of all the files there and then cuts out all commented out lines. This way you only get the repositories that are actually in use.

1
  • 1
    Thanks Andrew! I'll expand the above to also look into sources.list as older installs or external script may still add to it too. I was hoping some apt command would provide the information but this is as good.
    – MagicFab
    May 20, 2011 at 14:38
1

Using the existing apt python modules, you can write a very small script:

###################################################################    
##################file: apt-listsources############################
###################################################################
#!/usr/bin/python
import sys

from aptsources.sourceslist import SourcesList, SourceEntry

if __name__ == "__main__":

    list=SourcesList()
    for l in list.list:
        if l.invalid or l.disabled:
           continue
        print l.line
##################################################################            
1
  • Can you explicitly tell what your script does and what are its input/output ? It will be nice for non-python users. Thank you
    – NorTicUs
    Oct 23, 2012 at 9:39
-1

You could open software sources (In the edit menu of the software center) and then switch to other software tab .

enter image description here

0
-1

If you open software-properties-gtk, the Other Software tab will show a list of the extra repositories being used.

software-properties-gtk can be opened by opening Update Manager and selecting settings, or opening the Software Center, Edit -> Software Sources ...

enter image description here

1
  • Sorry if I wasn't clear in my question, I meant using command line (edited), not GUI tools - tx. anyways!
    – MagicFab
    Apr 5, 2011 at 17:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .