I would hope there is a better way to do this. The other day, I had a need to see all the interfaces on a router and how much input and output traffic they were passing. This just seems like something that should be built in, but I've not seen it.
So, this is what I did:
Router# show interfaces | include line_protocol|input_rate|output_rate
FastEthernet0/0 is administratively down, line protocol is down
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
Serial1/0 is up, line protocol is up
30 second input rate 29688000 bits/sec, 4210 packets/sec
30 second output rate 2456000 bits/sec, 1566 packets/sec
Serial1/1 is up, line protocol is up
30 second input rate 23508000 bits/sec, 3179 packets/sec
30 second output rate 2440000 bits/sec, 1649 packets/sec
FastEthernet2/0 is up, line protocol is up
30 second input rate 5172000 bits/sec, 3245 packets/sec
30 second output rate 53783000 bits/sec, 7380 packets/sec
FastEthernet2/1 is up, line protocol is down
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
LI-Null0 is up, line protocol is up
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
Loopback0 is up, line protocol is up
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
The include
let's you do pattern matching on the the output of the command that appears before the pipe. There's a few other useful commands that can act on the output of another command. I find section
to be extremely useful. For example, show running-config | section router_bgp
will output just the BGP configuration portion of your running config.