Number of ports by type

One common issue, and question, I get in the field is determining how many of a particular port type and speed is deployed in your data center network? This post will provide you a quick little command you can run on your Cisco Nexus switches, which outputs the interface and the type in a single line. You can manipulate manually, or export to a text file and send somewhere else for import into Excel:

show interface capabilities | section Ethernet | egrep ^Ethernet|^\s+Type | awk 'NR%2{printf "%s ", $0;next;}1'

A note for those using Nexus 7K and/or 5K infrastructure, you may run into issues with awk, so for now, this would work for you, just not as clean:

show interface capabilities | section Ethernet | egrep Ethernet|Type