VMware ESXi and vSphere Cluster Management
Cisco IOS Pipe Function: Filter show Command Output
Learn how to use the Cisco IOS pipe character with begin, include, and section filters to search running configuration and show command output.
The Cisco IOS pipe function filters command output so you can find relevant information without manually reviewing every line. Cisco IOS is the operating system and command-line environment used by many Cisco network devices. A show command displays operational information such as device status, interfaces, or configuration.
The pipe character is the vertical bar symbol: |. It sends the output of a command to an output-filtering function.
Why Use the Cisco IOS Pipe Function?
Commands such as show running-config can produce many lines. The pipe function lets you search or narrow that output directly on the device. This is useful when checking a particular configuration item, locating a status line, or reviewing one configuration section.
The pipe is primarily used with show commands and other commands that produce lengthy output. It does not change the device configuration; it only controls which command output is displayed.
General Pipe Command Structure
The general pattern is:
<command> | <filter> <keyword-or-expression>
For example:
show running-config | include password
- IOS runs
show running-config. - The pipe character separates the base command from the filtering operation.
- The
include passwordfilter examines the resulting output and displays matching lines.
Common filter patterns are:
<show-command> | begin <text>
<show-command> | include <text>
<show-command> | section <text>
The begin Filter
begin starts displaying output at the first line containing the specified text. All output before that first matching line is omitted. After the starting point, the remaining command output is displayed.
Example: Start at the First Interface Entry
show running-config | begin interface
This command searches the running configuration for the first line containing interface. The output begins at that line and continues through the rest of the command output.
The running configuration is the active configuration currently held in memory by the device. Beginning at the first interface entry can make it easier to skip introductory lines and move directly to interface-related configuration.
When to Use begin
Use begin when you know approximately where the information starts in a long output and want to view that point onward. It is useful for navigation, but it does not isolate only one configuration block.
The include Filter
include displays only lines containing the requested text. Every nonmatching line is suppressed. Unlike begin, it does not display the rest of the output after a match.
Example: Find Password-Related Lines
show running-config | include password
This command displays only running-configuration lines that contain password. It is useful for quickly finding individual configuration lines related to passwords or password-based access.
Because include returns matching lines rather than surrounding context, it may not show the complete configuration feature that contains those lines.
When to Use include
Use include when you are searching for individual lines containing a known term. It is often the fastest choice for a keyword search.
The section Filter
section displays the configuration section associated with a requested feature or heading. A configuration section, also called a stanza, is a heading followed by the commands that belong to it.
Example: Review the VTY Configuration
show running-config | section vty
This command displays the VTY-related configuration block instead of the complete running configuration. VTY means virtual terminal lines, which are used for remote management access to a Cisco device.
section differs from include in an important way:
includereturns only individual lines containing the search text.sectionreturns the relevant configuration block, including commands associated with that section.
When to Use section
Use section when you need to understand or verify a complete configuration stanza, such as VTY lines or another feature with a recognizable configuration heading.
Cisco IOS Pipe Filter Comparison
| Filter | Syntax pattern | What it displays | Best use case | Example |
|---|---|---|---|---|
begin | <show-command> | begin <text> | Output from the first line containing the text through the rest of the output | Starting at a known point in long output | show running-config | begin interface |
include | <show-command> | include <text> | Only lines containing the text | Searching for individual matching lines | show running-config | include password |
section | <show-command> | section <text> | The matching configuration section or stanza | Reviewing a complete feature block | show running-config | section vty |
Choosing the Right Filter
- Choose
beginwhen the desired information occurs near a known point in a long output and you want everything from that point onward. - Choose
includewhen you need individual lines containing a term such aspassword. - Choose
sectionwhen you need the complete configuration stanza for a feature, such as the VTY configuration.
Practical Workflow
- Enter the appropriate Cisco IOS command-line mode and ensure you have the privilege level required to run the show command.
- Run the base command without a filter if you are unsure what text or heading to search for.
- Choose
begin,include, orsectionbased on whether you need a starting point, matching lines, or a complete section. - Check the filtered output and confirm that the result contains the context needed for your task.
Lab Platform Support
Cisco Packet Tracer does not support the IOS pipe function discussed in this lesson. As a result, commands such as show running-config | include password may not be accepted there.
GNS3 is a suitable environment for practicing these commands when it is configured with an IOS image or compatible device software. More generally, use a platform running a Cisco IOS image or compatible Cisco command-line implementation when pipe filters are unavailable in a simulator.
Troubleshooting Pipe Filters
Pipe or Filter Keywords Are Unavailable
Symptom: The pipe operator or filter keywords are rejected in Packet Tracer.
Cause: Packet Tracer does not support the pipe function covered here.
Resolution: Practice in GNS3 or another environment that provides a compatible Cisco IOS command-line implementation.
begin Produces No Expected Output
Symptom: The output does not begin where expected, or no useful output appears.
Cause: The search text does not match a line in the base command output, or the text appears differently than expected.
Resolution: First view the unfiltered command output. Then copy a matching word or phrase and use it with begin.
include Returns Too Few Lines
Symptom: The result contains matching lines but not the surrounding configuration.
Cause: include returns individual matching lines only.
Resolution: Use section when you need the complete configuration stanza and its related commands.
Exam-Relevant Notes
- The pipe character is
|, and it separates a command from an output filter. beginstarts output at the first matching line.includedisplays only matching lines.sectiondisplays a matching configuration block.- The pipe function filters displayed output; it does not modify the running configuration.
- Packet Tracer does not support the pipe function covered in this lesson.
For related practice, review Cisco IOS command output filtering with the pipe function.