CIsco NX-OS

The Command Line Interface

Saving and Restore a command mode

switch# configure terminal
switch(config)# event manager applet test 
switch(config-applet)# push 
switch(config-applet)# configure terminal  
switch(config)# username testuser password newtest
switch(config)# pop 
switch(config-applet)#
  • can use where command to check current mode

Command Alias

cli alias name ethint interface ethernet 
cli alias name shintbr show interface brief 
cli alias name shintupbr shintbr | include up | include ethernet

Use a command alias

switch# configure terminal
switch(config)# ethint 2/3
switch(config-if)#

Command Script

Run script

Setting CLI Display Colors

  • terminal color: set cli display colors for the terminal session

  • terminal color persist: make persistent across sessions for the current username

Command history

  • show cli history [lines] [config-mode | exec-mode | this-mode-only][unformatted]

    • lines: number of line

    • config-mode: display only configuration command

    • exec-mode: display only exec commands

    • this-mode-only: display history in the current command mode

    • unformatted: without showing command number and timestamp

  • Recalling a command: !

  • change CLI edit Mode from emacs to vi: switch# terminal edit-mode vi [persist]

Search and Filtering

Commands
Description

[lines]

Displays output lines for either the specified number of lines or the current screen size.

[lines]z

Displays output lines for either the specified number of lines or the current screen size. If you use the lines argument, that value becomes the new default screen size.

[lines]

Displays output lines for either the specified number of lines or the current default number of lines. The initial default is 1 line. If you use the optional lines argument, that value becomes the new default number of lines to display for this command.

[lines]d or [lines]Ctrl+shift+D

Scrolls through output lines for either the specified number of lines or the current default number of lines. The initial default is 11 lines. If you use the optional lines argument, that value becomes the new default number of lines to display for this command.

q or Q or Ctrl-C

Exits the --More–- prompt.

[lines]s

Skips forward in the output for either the specified number of lines or the current default number of lines and displays a screen of lines. The default is 1 line.

[lines]f

Skips forward in the output for either the specified number of screens or the current default number of screens and displays a screen of lines. The default is 1 screen.

=

Displays the current line number.

[count]/expression

Skips to the line that matches the regular expression and displays a screen of output lines. Use the optional count argument to search for lines with multiple occurrences of the expression. This command sets the current regular expression that you can use in other commands.

[count]n

Skips to the next line that matches the current regular expression and displays a screen of output lines. Use the optional count argument to skip past matches.

{!

:![shell-cmd]}

.

Repeats the previous command.

TCL Script

Ping list of addresses

Collecting Log

Reference

  • Admin VDC on Nexus 7k: https://community.cisco.com/t5/data-center-and-cloud-knowledge-base/chalk-talk-admin-vdc-on-nexus-7000-explained/ta-p/3134781

Last updated