Commands / Text and objects

Group-Object

Group objects by a property

intermediate Text and objects Aliases group

Group-Object
 Get-ChildItem -File | Group-Object -Property Extension
Works on
WindowsLinuxmacOS
PowerShell
5.1 and later
Reference
Microsoft Learn: Group-Object

Buckets objects. Each group has Name, Count, and Group (the members). Great for "how many of each extension".

Try this

Get-ChildItem -File | Group-Object Extension | Sort-Object Count -Descending

Related commands