Thursday, March 29, 2018

apt - How does one count the packages in Ubuntu's repositories from the command-line?



On many distributions and the BSDs there are ways to determine the number of packages in the distro's enabled repositories, e.g. on FreeBSD you could use pkg stats, is there such a way with Ubuntu? I know how to count the number of installed packages, namely using:




dpkg -l | wc -l


which on my Ubuntu 18.04 Bionic Beaver (developmental version) system returns 1962 (and yes I know not to rely on the stability of a developmental release, as things can and often do break, this is just a system for me to satisfy my curiosity about the new release to come), but how do I count all packages in its enabled repositories?



I would imagine that apt-cache search "*" would return a list of all available packages, which I could then count with wc -l but no it returns:



E: Regex compilation error



.



apt-cache has a function to list all packages



sudo apt-cache pkgnames | wc -l


returns 58218 packages with main, universe, multiverse, restricted and backports enabled on artful.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...