if you’re managing a Cisco switch, you know the challenge of identifying ports that haven’t been used for a while. Here’s a simple command to quickly check for “free” ports—those that are either down or haven’t seen any activity in weeks.
To list all interfaces and their last input/output status, use:
show int | i proto|Last in
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | Cisco#show int | i proto|Last in Vlan1 is administratively down, line protocol is down , Autostate Enabled Last input 12w5d, output never, output hang never 0 unknown protocol drops Vlan999 is up, line protocol is up , Autostate Enabled Last input 00:00:00, output 00:00:00, output hang never 0 unknown protocol drops GigabitEthernet0/0 is administratively down, line protocol is down Last input never, output never, output hang never 0 unknown protocol drops TwoGigabitEthernet1/0/1 is up, line protocol is up (connected) Last input 00:00:05, output 00:00:00, output hang never 258747 unknown protocol drops TwoGigabitEthernet1/0/2 is up, line protocol is up (connected) Last input 00:00:07, output 00:00:00, output hang never 258781 unknown protocol drops TwoGigabitEthernet1/0/3 is up, line protocol is up (connected) Last input 00:00:12, output 00:00:00, output hang never 258697 unknown protocol drops TwoGigabitEthernet1/0/4 is up, line protocol is up (connected) Last input 00:00:27, output 00:00:00, output hang never 258713 unknown protocol drops TwoGigabitEthernet1/0/5 is up, line protocol is up (connected) Last input 00:00:00, output 00:00:00, output hang never 258705 unknown protocol drops TwoGigabitEthernet1/0/6 is up, line protocol is up (connected) Last input 00:00:27, output 00:00:00, output hang never 258721 unknown protocol drops TwoGigabitEthernet1/0/7 is up, line protocol is up (connected) Last input 00:00:09, output 00:00:00, output hang never 258714 unknown protocol drops TwoGigabitEthernet1/0/8 is down, line protocol is down (notconnect) Last input never, output never, output hang never 0 unknown protocol drops |
For a more targeted approach, showing only the down or unused ports for 6+ weeks:
show int | i proto.*notconnect|proto.*administratively down|Last in.*[6-9]w|Last in.*[0-9][0-9]w|[0-9]y|Last input never, output never, output hang never