Filters for show command display

Some show commands can have a very long display. In order to effectively find the parts of the long show command that you want to see, you can filter the show command display by using the show command followed by a “|” (pipe) to determine what kind of display you want to filter.

R1#show running-config | ?
  append    Append redirected output to URL (URLs supporting append operation
            only)
  begin     Begin with the line that matches
  exclude   Exclude lines that match
  include   Include lines that match
  redirect  Redirect output to URL
  section   Filter a section of output
  tee       Copy output to URL

The main filters have the following meanings

beginDisplay from the line containing the specified string
excludeExclude the lines containing the specified string
includeDisplay only the lines containing the specified string
sectionDisplay only the section that contains the specified string
Table. Meaning of the main filter

A section is a grouping of lines and the indented lines that follow. The following is an example of the interface FastEtehernet0/0 section of show running-config.

Fig. section example
Fig. section example

Example of show command display filter

The following is an example of a filter for the show command display.

begin

This is an example of a filter that starts displaying running-config from a line that contains “interface FastEtehernet0/0” as a display filter for begin.

R1#show running-config | begin interface FastEthernet0/0
interface FastEthernet0/0
 ip address 192.168.1.254 255.255.255.0
 duplex auto
 speed auto
!
!
no ip http server
ip forward-protocol nd
!
~省略~

exclude/include

The following is an example of the exclude and include filters: show ip interface brief to see the IP address and status of the interface. This is an example of showing only those interfaces whose interface status is up/up.

You can “exclude down” to exclude the down interface, or “include up” to exclude the up interface. Or you can “include up” to extract and display only the up interfaces.

R1#show ip interface brief
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.254   YES manual up                    up
Loopback0                  192.168.0.1     YES manual administratively down down
R1#show ip interface brief | exclude down
Interface                  IP-Address      OK? Method Status                Protocol
FastEthernet0/0            192.168.1.254   YES manual up                    up
R1#show ip interface brief | include up
FastEthernet0/0            192.168.1.254   YES manual up                    up

section

Here is an example of a display filter using section. If you specify “section line”, it will show only the section of the line that contains “line”. This will show only the section settings for “line con 0”, the section settings for “line aux 0” and the section settings for “line vty 0 4”.

R1#show running-config | section line
line con 0
 exec-timeout 0 0
 privilege level 15
 password 7 094F471A1A0A
 logging synchronous
 login
line aux 0
 exec-timeout 0 0
 privilege level 15
 password 7 060506324F41
 logging synchronous
 login
line vty 0 4
 login local

Show only the specific interface part of running-config/startup-config

You can also use show running-config/show startup-config to show only parts of an interface. show running-config/show startup-config is followed by interface <interface-name> is specified, only the part of the interface will be displayed.

R1#show running-config interface loopback 0
Building configuration...

Current configuration : 77 bytes
!
interface Loopback0
 ip address 192.168.0.1 255.255.255.255
 shutdown
end

Cisco Basic