2

I'm comparing Ubuntu to other distributions for a number of factors, and for one factor I need the number of source packages, which is probably a better indicator than the total number of packages a distribution has.

It looks like I could use apt-cache dumpavail and from each section get the package name or the source name, if there is one, then get a unique count from that. But, is there an easier, faster way?

2
  • Have you looked at the output of apt-cache stats?
    – enzotib
    Commented Feb 11, 2012 at 6:32
  • I looked at apt-cache stats, but I didn't see anything that looked like the count of source packages. Commented Feb 11, 2012 at 20:37

2 Answers 2

2

You can grep the number of Package: lines in the files whose names end in _Sources in the directory /var/lib/apt/lists/:

grep '^Package: ' /var/lib/apt/lists/*_Sources | wc -l

On my Ubuntu 11.10 machine I get the number 17150.

1
  • 1
    Since I have a ppa that copies some packages from Ubuntu, I ended up using this: grep -h '^Package: ' /var/lib/apt/lists/*_Sources | sort -u | wc -l Commented Feb 11, 2012 at 22:36
1

Maybe you can dump the output to a text file and then using gedit , find the number of lines , the number of lines represent the number of packages. ( I assume that 1 package takes 1 line)

You must log in to answer this question.

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