Someone asked me about adding a package count to env-info, and I'm probably not going to do this because it would require conditional code based on the distro you are using. But it did make me investigate how easy this is to do in different distros, and looking at the output might make you reconsider some things you have installed and no longer use.
I've only investigated three distros so far, and here is one command to give you a list, and another expression to give you just the count for each of the three. I find these lists very interesting and useful for pruning crap you installed and then forgot about.
Debian
Code: Select all
dpkg -l | grep ^ii | less # list
dpkg -l | grep ^ii | wc -l # count
Arch
Code: Select all
pacman -Q | less # list
pacman -Q | wc -l # count
CRUX
Code: Select all
prt-get listinst | less # list
prt-get listinst | wc -l # count
Of course you can redirect the list output to a file instead of less, and as always I apologize if this has already been discussed elsewhere.
If you know you will always use env-info on a Debian system, feel free to hack the code. Just add a function like this:
Code: Select all
print-pkgcount() {
count=$(dpkg -l | grep ^ii | wc -l)
color_echo Packages $count
}
And then call the function in the list at the end, wherever you want the output, like this
Code: Select all
print-disk
print-mem
print-pkgcount
(edit) I do have a conditional version working now, but I still don't think I will add it to the main version of env-info. I'd like to keep that one simple. I may just use it in my experimental version of the script.