Try   HackMD
IOS Command-Line Interface

Basic Commands

Switch> enable
Switch# configure terminal
Switch(config)# end
Switch# show running-config
! Building configuration...
! Current configuration : 158 bytes
! <...output truncated...>
!
Switch# 

Commands that generate multiple screens of output are, by default, paused after 24 lines. Use the terminal length command to specify the number of lines to be displayed. A value of 0 (zero) prevents the router from pausing between screens of output.

Filtering Output

Another very useful feature that improves the user experience in the CLI is the filtering of show output. Filtering commands can be used to display specific sections of output. To enable the filtering command, enter a pipe (|) character after the show command and then enter a filtering parameter and a filtering expression.

There are four filtering parameters that can be configured after the pipe.

– section
R1# show running-config | section line vty
! line vty 0 4
!  password 7 110A1016141D
!  login
!  transport input all
– include
R1# show ip interface brief
! Interface              IP-Address       OK?  Method   Status   Protocol
! GigabitEthernet0/0/0   192.168.10.1     YES  manual   up       up
! GigabitEthernet0/0/1   192.168.11.1     YES  manual   up       up
! Serial0/1/0            209.165.200.225  YES  manual   up       up
! Serial0/1/1            unassigned       NO   unset    down     down
R1#
R1# show ip interface brief | include up
! GigabitEthernet0/0/0   192.168.10.1     YES  manual   up       up
! GigabitEthernet0/0/1   192.168.11.1     YES  manual   up       up
! Serial0/1/0            209.165.200.225  YES  manual   up       up
– exclude
R1# show ip interface brief
! Interface              IP-Address       OK?  Method   Status   Protocol
! GigabitEthernet0/0/0   192.168.10.1     YES  manual   up       up
! GigabitEthernet0/0/1   192.168.11.1     YES  manual   up       up
! Serial0/1/0            209.165.200.225  YES  manual   up       up
! Serial0/1/1            unassigned       NO   unset    down     down
R1#
R1# show ip interface brief | exclude unassigned
! Interface              IP-Address       OK?  Method   Status   Protocol
! GigabitEthernet0/0/0   192.168.10.1     YES  manual   up       up
! GigabitEthernet0/0/1   192.168.11.1     YES  manual   up       up
! Serial0/1/0            209.165.200.225  YES  manual   up       up
– begin
R1# show ip route | begin Gateway
! Gateway of last resort is not set
!     192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
! C      192.168.10.0/24 is directly connected, GigabitEthernet0/0/0
! L      192.168.10.1/32 is directly connected, GigabitEthernet0/0/0
!     192.168.11.0/24 is variably subnetted, 2 subnets, 2 masks
! C      192.168.11.0/24 is directly connected, GigabitEthernet0/0/1
! L      192.168.11.1/32 is directly connected, GigabitEthernet0/0/1
!     209.165.200.0/24 is variably subnetted, 2 subnets, 2 masks
! C      209.165.200.224/30 is directly connected, Serial0/1/0
! L      209.165.200.225/32 is directly connected, Serial0/1/0

Command History

The command history feature is useful because it temporarily stores the list of executed commands to be recalled. By default, command history is enabled and the system captures the last 10 command lines in its history buffer.

Use the terminal history size user EXEC command to increase or decrease the size of the buffer (during the current terminal session only). Use the show history privileged EXEC command to display the contents of the buffer.

R1# terminal history size 200
R1# show history
! show ip int brief
! show interface g0/0/0
! show ip route
! show running-config
! show history
! terminal history size 200