IOS supports the use of the pipe character (represented with the | character) to filter the output of the show and more commands. The pipe function takes the output of the command and sends it to another function, such as begin or include. This way, you can filter the output to find the section of the output that interests you. Here are a few examples:
R1#show running-config | begin interface interface FastEthernet0/0 ip address 10.10.10.1 255.255.255.0 duplex auto speed auto ! interface FastEthernet0/1 no ip address shutdown duplex auto speed auto ! interface FastEthernet1/0 no ip address shutdown duplex auto speed auto ! interface FastEthernet2/0 no ip address shutdown duplex auto speed auto ! --More--
In the picture above you can see that we’ve entered the show running-config | begin interface command (we could have abbreviated it to show run | b int). This command starts the output from the first occurence of the word interface.
Another example, this time with include:
R1#show run | include password no service password-encryption enable password cisco password cisco password cisco
As you can see from the example above, the include function displays only lines that include the word password. The include function is helpful in some situations but can also be confusing because it only includes exact matching commands with no context around them, as in this example with password cisco shown twice in the output.
To display only the section of the output about a certain feature, use the section function:
R1#show run | section vty line vty 0 4 password cisco login line vty 5 15 password cisco login
You can see in the example above that the command displayed only the vty section of the running configuration. The section function is not supported for all parts of the configuration, but can be very helpful for example to view all the configuration for a particular routing protocol:
R1#sh run | sec ospf ip ospf cost 100 router ospf 1 log-adjacency-changes passive-interface FastEthernet0/0 network 10.10.0.0 0.0.255.255 area 0
Cisco Packet Tracer doesn’t support the pipe function. The examples above were created in GNS3.
Download our Free CCNA Study Guide PDF for complete notes on all the CCNA 200-301 exam topics in one book.
We recommend the Cisco CCNA Gold Bootcamp as your main CCNA training course. It’s the highest rated Cisco course online with an average rating of 4.8 from over 30,000 public reviews and is the gold standard in CCNA training: