Let's Count the Installed Packages!

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
13,047
I meant to share this earlier. It was published much earlier, but then I had to leave for a few minutes. When I returned, my scatterbrain didn't remember to share it.


Now, the count could possibly end up slightly off - but that's not actually the point. The point is to share the commands and maybe help people get just a little more fluent in the terminal. I looked and I didn't find a ton of packages with an 'ii' in the name. So, the count should be fairly accurate. Still, it's a fun little exercise to see some more about processing text in the terminal.

As always, I absolutely love the feedback I get.
 


craigevil

Member
Credits
502
For those with either neofetch or inxi installed both will show packages installed.
Packages: 2326 apt: 2311 flatpak: 5 snap: 10

Another way to do it is:
Code:
sudo dpkg-query -f '${binary:Package}\n' -W | wc -l
Which in my case shows: 2311
 
Last edited:

f33dm3bits

Gold Member
Gold Supporter
Credits
15,000
Also this is an unnecessary use of cat.
Code:
cat Documents/installed_apps.txt | grep ii | wc -l
Can be done like this as well but you probably already know that?
Code:
grep ii Documents/installed_apps.txt | wc -l
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
13,047
Yup. I was really just trying to introduce the commands. Even the end results aren't necessarily accurate, it's just to play around with the terminal for a bit. You don't even need to have the installed_apps.txt file.
 

Nik-Ken-Bah

Well-Known Member
Credits
1,460
Yup. I was really just trying to introduce the command
Thank you and appreciated by this non-geek, geek.
I have a funny way of learning things that make them stick longer in memory.
 

KGIII

Super Moderator
Staff member
Gold Supporter
Credits
13,047
Thank you and appreciated by this non-geek, geek.
I have a funny way of learning things that make them stick longer in memory.
I try to make them relatable and interesting. Something you can do to actually see what's going on - but not overwhelming, just a small bite. The ultimate goal is for people looking for those types of things to learn a variety of commands. Ideally, people will find the site via search engines.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online


Top