Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Use the CLI

MANUAL PAGE

1/190 80-AXI 101 09/1 Uen B


Copyright

© Ericsson AB 2016. All rights reserved. No part of this document may be


reproduced in any form without the written permission of the copyright owner.

Disclaimer

The contents of this document are subject to revision without notice due to
continued progress in methodology, design and manufacturing. Ericsson shall
have no liability for any error or damage of any kind resulting from the use
of this document.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Contents

Contents

1 Use the CLI 1


1.1 Operational Structure, Command Modes, and Prompts 2
1.1.1 Command Modes and Prompts 2
1.1.2 Command Mode Hierarchy 3
1.1.3 Privilege Levels 4
1.2 Using the CLI to Configure and Administer the Router 4
1.2.1 Navigating the CLI 4
1.2.2 Displaying Available Syntax 5
1.2.3 Displaying Help for a Command 6
1.2.4 Distinguishing Required and Optional Keywords and
Arguments 7
1.2.5 Exiting Command Modes 7
1.2.6 Recalling Previous Command Entries 7
1.2.7 Editing Command Entries 8
1.2.8 Navigating Command Output 8
1.2.9 Completing a Command 9
1.2.10 Managing Database Transactions 9
1.2.11 Using Context-Specific show Commands 10
1.2.12 Modifying Output of show Commands 10
1.2.13 Configuring a Command Alias 16
1.2.14 Creating a Command Macro 17

1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

1 Use the CLI

This document describes the tasks and commands you use to navigate and
use the command-line interface (CLI). It also describes the command mode
hierarchy and how to display help for a command, recall previous command
entries, and edit command entries.

Note: In this section, the command syntax in the task table displays only
the root command; for the complete command syntax, search for
the command in the Command List to find the command reference
documentation with the full description for the command.

The CLI can be accessed as follows:

• Local Management Interface connection to a local management workstation

Requires a PC-type workstation with a Telnet or Secure Shell (SSH) client,


and a shielded Ethernet crossover cable.

• Local Management Interface connection to a remote management


workstation

Requires a PC-type workstation with a Telnet or SSH client.

Requires a shielded Ethernet straight cable (shipped with the system) or a


router or bridge.

• CONSOLE port connection to a local console terminal

For a local terminal, choose one of the following:

0 ASCII/VT100 console terminal or equivalent that runs at 9600 bps or


115200 bps, 8 data bits, no parity, 1 stop bit.

0 PC-type workstation with a terminal emulator, in the same configuration


as the ASCII/VT100 terminal.

A console cable.

• CONSOLE port connection to a remote console terminal

For a local terminal, choose one of the following:

0 ASCII/VT100 console terminal or equivalent that runs at 9600 bps or


115200 bps, 8 data bits, no parity, 1 stop bit.

0 PC-type workstation with a terminal emulator, in the same configuration


as the ASCII/VT100 terminal.

A terminal server and a server cable.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 1


Use the CLI

Note: By default, all access services are disabled, and must be enabled using
the service <access protocol> command. For information on
supported access services, refer to the section describing service
commands in Commands: S (sa-filter to sham link). SSH sessions are
encrypted with the single Data Encryption Standard (DES) algorithm.

It is recommended that you have two access methods available, such as a


remote workstation connected to the Local Management Interface and a remote
console terminal with connection to a terminal server. Many administrative
tasks should be carried out from the CLI when connected through a terminal
server, because some processes, such as reloading or upgrading the software,
may sever an Local Management Interface connection.

1.1 Operational Structure, Command Modes, and Prompts


In the CLI, the two primary modes are exec and global configuration.

1.1.1 Command Modes and Prompts


When a session is initiated, the CLI is set to the exec mode by default. The
exec mode allows you to examine the state of the system and perform most
monitoring, troubleshooting, and administration tasks using a subset of the
available CLI commands.

Exec mode prompts can be one of the following forms, depending on the user
privilege level (see Section 1.1.3 on page 4).

[local]hostname#
[local]hostname>

In this example, local is the context in which commands are applied and
hostname is the currently configured hostname of the router. When you exit
exec mode using the exit command, the entire CLI session ends.

Global configuration mode is the top-level configuration mode; all other


configuration modes are accessed from this mode. The configuration modes
allow you to configure the system through the CLI, or to create and modify a
configuration file offline by entering configuration commands using any text
editor. After you have saved the file, you can then load it to the Ericsson
IP Operating System.

To access global configuration mode, enter the configure command in


exec mode.

Configuration mode prompts take the following form:

[local]hostname(mode-name)#

2 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

In the example, local is the context in which commands are applied,


hostname is the currently configured hostname of the router, and mode-name
is a string indicating the name of the current configuration mode.

The prompt in global configuration mode, assuming the factory default


hostname of Ericsson and the local context, is:

[local]Ericsson(config)#

Each feature supported through the operating system can have one or more
configuration modes, some of which you access by using a command in global
configuration mode. Table 1 lists the configuration modes for the commands
described in this document and the commands that you enter to access them.

1.1.2 Command Mode Hierarchy


Command modes exist in a hierarchy. You must access the higher-level
command mode before you can access a lower-level command mode in the
same chain.

Table 1 lists a sample of the command modes, in alphabetical order, for the
basic system features. This is not a comprehensive list and is provided only
as a sample. For more information about the command modes, see individual
commands in Command List.

Table 1 Basic System Features: Command Modes and System Prompts


Mode Name Commands Used to Access Command-Line Prompt
exec (user logon) # or >
administrator administrator command from (config-administrator)#
context configuration mode
bulkstats bulkstats policy command (config-bulkstats)#
from context configuration mode
context context command from global (config-ctx)#
configuration mode
dot1q profile dot1q profile command from (config-dot1q-profile)#
global configuration mode
global configure command from exec (config)#
mode
interface interface command from context (config-if)#
configuration mode
licensing licensing (config-licensing)#
command from global configuration
mode

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 3


Use the CLI

Table 1 Basic System Features: Command Modes and System Prompts


Mode Name Commands Used to Access Command-Line Prompt
macro macro command from global (config-macro)#
configuration mode
port port ethernet command from (config-port)#
global configuration mode
snmp server snmp server command from (config-snmp-server)#
global configuration mode
stats-collection stats-collection command (config-stats-collect)#
from global configuration mode
storm-control storm-control command from (config-port-storm-ctrl-pp
port configuration mode s)#
(config-port-storm-ctrl-kb
ps)#

1.1.3 Privilege Levels


The operating system supports 16 different privilege levels for administrators
and commands. To control access to the CLI, administrators are assigned an
initial privilege level of 6 by default. Administrators can only issue commands
that are assigned at the same level as their current privilege level or lower than
their current privilege level.

Each command in the CLI is assigned a default privilege level. At a privilege


level of 7 or higher, the prompt in the CLI displays a number sign (#) instead of
an angle bracket (>).

For more information about assigning privilege levels to administrators, see


Restrict Access to the CLI.

1.2 Using the CLI to Configure and Administer the Router


The primary administrator interface is the CLI. Access the CLI from the console
port or through a remote session (for example, Telnet or Secure Shell [SSH]) to
monitor, administer, and troubleshoot the system.

1.2.1 Navigating the CLI

To navigate the CLI, perform the tasks described in Table 2.

4 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

Table 2 Navigate the CLI


Task Root Command Notes
Return the privilege level for the current disable When you create the account,
exec session to the initial privilege level the initial privilege level is
configured for the current administrator specified.
account.
Enter this command in exec
mode.
Change the current privilege level for enable You can specify a level up
an exec session while in exec mode. to the max level specified for
your account.
Enter this command in exec
mode.
Return to exec mode while in any end Enter this command in any
configuration mode. configuration mode.
Terminate the current CLI session exit Enter this command in exec
while in exec mode. mode.
Move up one level in the configuration exit Enter this command in any
mode hierarchy while in a configuration configuration mode when
mode. Return to exec mode while in transaction is committed.
global configuration mode.
Enter global configuration mode. configure Enter this command in
exec mode only for local
administrator.
Display the current configuration or show configuration Enter this command in any
the contents of a previously saved configuration mode.
configuration file on the local file
system.
Display the command history for the show history Enter this command in any
current session. configuration mode.

1.2.2 Displaying Available Syntax


The following output displays the commands available for an administrator at
privilege level 3 in global configuration mode:

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 5


Use the CLI

[local]Ericsson> ?

auto-integration Auto-integration commands


archive Archive configurations for rollback
bulkstats Manage bulk statistics collection file
change-password Change current login password
disable Drop into disable administrator mode
enable Modify command mode privilege
exit Exit exec mode
file-access Change permissions of a file or directory
help Description of the interactive help system
modify Modify condition action for ACL rule
monitor Monitor information
more Display the contents of a file
mrinfo Request multicast router information
mtrace Trace reverse multicast path from source to receiver
no Disable an interactive option
oam oam commands
ping Packet Internet Groper Command
rollback Rollback a configuration
show Show running system information
ssh Execute SSH/SSHD commands
start Start a software process or service
stop Stop a software process or service
telnet Telnet to a host
terminal Modify terminal settings
traceroute Trace route to destination
twamp Twamp commands

The following example uses partial help to display all commands in exec mode
that begin with the character sequence cl:
[local]Ericsson#cl?
clock clear

In this case, add another letter to select the clock or clear commands.

The following example uses full help to display the next argument of a partially
complete clock command in global configuration mode:
[local]Ericsson(config)#system clock ?

summer-time Configure summer (daylight savings) time


timezone Configure time zone

1.2.3 Displaying Help for a Command

To access the online Help for the CLI:

• Use the ? command when entering a command to display the options


available at the current state of the command syntax.

• Use the help command to display how to use the ? character to obtain
help.

For more information about the ? command, see Commands: A.

The following example displays help for the first keywords available in the
release command.

6 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

[local]Ericsson#release ?

confirm Confirms the upgrade


create Creates a new UpgradePackage specified by a URI
download Download by an UpgradePackage
erase Erase a software version or upgrade package
rollback Rollback the software version to the previous one
upgrade Upgrade to take the UpgradePackage into operation fully
verify Verifies the ability to activate current upgrade package

1.2.4 Distinguishing Required and Optional Keywords and Arguments


When entering the ? command to display available commands, keywords, and
arguments, one or more of the listed items is optional, if the carriage-return
<CR> (Enter key on the keyboard) is not displayed at the end of the list.

In the following example, the Output modifiers are optional:


[local]Ericsson#show port counters | grep 1/2 ?
| Output Modifiers
<cr>

In the following example, summer-time or timezone is required with the


system clock command:
[local]Ericsson(config)#system clock ?
summer-time Configure summer (daylight savings) time
timezone Configure time zone
[local]Ericsson(config)#

1.2.5 Exiting Command Modes


The following example exits global configuration mode and transactions are
committed when returning to exec mode with exit or end:
[local]Ericsson(config)#exit
[local]Ericsson#

The following example exits a CLI session:


[local]Ericsson#exit

The following example exits context configuration mode and returns to exec
mode:
[local]Ericsson(config-ctx)#end
[local]Ericsson#

1.2.6 Recalling Previous Command Entries


Table 3 lists two Emacs-style command keyboard sequences that allow you to
step through previously entered commands.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 7


Use the CLI

Table 3 Recall Previously Entered Commands


Keyboard Description
Ctrl + p or up Recalls previous command in the
arrow command history.
Ctrl + n or down Recalls next command in the command
arrow history.

1.2.7 Editing Command Entries


Table 4 lists additional Emacs-style command keyboard sequences.

Table 4 Additional Emacs-Style Keyboard Sequences


Keyboard Description
Ctrl+f or right Moves cursor forward one character.
arrow
Ctrl+b or left Moves cursor backward one character.
arrow
Esc+f Moves cursor forward one word.
Esc+b Moves cursor backward one word.
Ctrl+a Moves cursor to beginning of line.
Ctrl+e Moves cursor to end of line.
Ctrl+k Deletes to end of line.
Ctrl+u Deletes to beginning of line.
Ctrl+d Deletes character.
Esc+d Deletes word.
Ctrl+c Quits editing the current line.
Ctrl+l Refreshes (redraws) the current line.
Ctrl+t Transposes current character with
previous.

For more information on Emacs key bindings, see the GNU Emacs
documentation at http://www.gnu.org.

1.2.8 Navigating Command Output


The CLI automatically pages output for console, Telnet, and SSH sessions.
The operating system prints --more-- to indicate the presence of more output.
To navigate command output, use the keys described in Table 5.

8 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

Table 5 Keys for Navigating Content


Key Function
q Skips all remaining output and returns to
the CLI prompt.
Enter Displays one additional line of output.
Space Displays the next page of output.

Note: You can use the terminal length and terminal width
commands in exec mode to specify a terminal size to paginate the
output. For more information, see Basic System Operations.

1.2.9 Completing a Command


You can use the Tab key in any mode to complete a command. Partially
typing a command name and pressing the Tab key cause the command to be
displayed in full to the point where it is no longer unique and a further choice
has to be made.

1.2.10 Managing Database Transactions

This section provides examples for database committing and transactions


deleting, committing transactions with exit and end commands and providing
comments for transactions.

1.2.10.1 Committing Transactions

The following example commits the current database transaction in 60 minutes


and includes the comment, Cfg BGP in local ctx, to help identify the
commit:

[local]Ericsson(config)#commit in 60 Cfg BGP in local ctx

1.2.10.2 Deleting Transactions

The following example deletes the current transaction:

[local]Ericsson(config)#abort

1.2.10.3 Providing Comments for Transactions

The following example adds a comment for the current transaction:

[local]Ericsson(config-ctx)#comment Config context local

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 9


Use the CLI

1.2.11 Using Context-Specific show Commands

Some show commands are context-specific; for example, the show dhcp
server commands. The output for these commands are displayed only if
the current (enabled) context is where the process is operating or where the
feature has been configured.

In non-configuration modes, to display data from a different context than the


one currently enabled, enter the context ctx-name construct as a preface
to the show command. For details and examples, see the Context-Specific
Examples section in context command reference page.

1.2.12 Modifying Output of show Commands

All show commands accept a common set of keywords and arguments called
modifiers that you can use to refine the command output. For example, you
can specify the line number at which the output is to begin, output only lines
containing certain patterns, and apply filtering criteria that pass only those
lines you want to see.

This section describes the syntax of show command output modifiers and how
to get help for the grep (global regular expression print) command in the CLI. It
also provides examples of a show command displaying lines before and after a
pattern, a show command displaying lines that include a pattern, and a show
command displaying lines that match a grep pattern.

1.2.12.1 Syntax of show Command Output Modifiers

The syntax for the output modifiers is:

[| {begin [before lines] [after lines] pattern | count | exclude


pattern | include pattern | join-lines | grep { [options options]
pattern} | save filename}]

Table 6 describes how each modifier affects the show command output.

Table 6 Modifier Syntax Descriptions


Modifier Description
| Modifies the output with the keywords that follow; that is,
pipes the output of the show command into keyword-specified
functions that control which lines of the output display.
append Appends the output to the file.

10 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

Table 6 Modifier Syntax Descriptions


Modifier Description
begin pattern Displays output beginning at the first occurrence of text
matching the specified pattern. Surrounds groups of words
that must be matched as a unit with double quotes. The
pattern must be a regular expression. For more information
on regular expressions, see the GNU documentation at
http://www.gnu.org.
before lines Optional. Number of lines before the first line containing the
matching pattern to display.
after lines Optional. Number of lines after the first line containing the
matching pattern to display.
count Counts the number of lines generated by the show command
but does not display the lines.
exclude pattern Excludes all lines that contain text that matches the specified
pattern from the display.
include pattern Displays only the lines that contain text that matches the
specified pattern.
join-lines Optional. Temporarily arranges (concatenates) all lines of a
record entry (circuit, route, and so on) from a multi-line output
into a single-line output.
This keyword is convenient when using exclude and grep
keywords. Not all commands return concatenated output when
the join-lines keyword is issued. For output examples, see
Section 1.2.12.6 on page 15.
grep pattern Displays only the lines that contain text that matches the
specified pattern. The pattern must be a regular expression.
For more information on regular expressions, see Help for the
grep Command in the CLI.
options options Optional. UNIX grep command options.
save filename Output saved to the specified filename.

1.2.12.2 Help for the grep Command in the CLI

You can get help for the grep command by entering grep ? or grep --help
after a show command at the command line. For more information on the grep
command options, see the GNU grep documentation at http://www.gnu.org.

The following example displays using regular CLI help to understand the syntax
of the grep command.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 11


Use the CLI

[local]Ericsson#show port counters | grep ?


WORD Pattern to match
options Grep options starting with a hyphen
[local]Ericsson#show port counters | grep 1/2 ?
| Output Modifiers
<cr>

To get more detailed help, enter the --help keyword after adding the grep
command to a show command as in the following example:
[local]Ericsson#show hardware card 4 | grep --help
Usage: grep [OPTION]... PATTERN [FILE] ...
Search for PATTERN in each FILE or standard input.
Example: grep -i 'hello world' menu.h main.c

Table 7 describes regular grep expressions.

Table 7 Grep Regular Expression Descriptions


Syntax Element Description of Pattern to Be Matched
-E, --extended-regexp Extended regular expression.
-e, regexp=PATTERN Regular expression.
-F, --fixed strings Set of newline-separated strings.
-f FILE Grep command option followed by input
filename.
-G, --basic regexp Basic regular expression.
-i, --ignore-case Ignore case distinctions in the pattern.
-P, --perl-regexp Perl regular expression.
-s, --no-messages No error messages.
-w, --word-regexp Only whole words.
-v, --invert-match Non-matching lines.
-V, --version, --help, or --mmap Print version information and exit, display this
help and exit, or use memory-mapped input if
possible.
-x, --line-regexp Only whole lines.
-z, --null-data A data line that ends in 0 bytes, not a newline.

Table 8 describes the grep output and context control options.

Table 8 Grep Output and Context Control Options


Syntax Element Output
-A, --after-context=NUM Print NUM lines of the leading context.
-a, --text Equivalent to --binary-files=text.
-B, --before-context Print NUM lines of trailing context.
-b, --byte-offset Print the byte offset with output lines.

12 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

Table 8 Grep Output and Context Control Options


Syntax Element Output
-C, --context=NUM Print NUM lines of output context.
-c, --count Only print a count of matching lines per file.
-D, --devices=action How to handle devices, FIFOs, and sockets.
Actions could be read (the default) or skip.
-d, --directories=ACTION How to handle directories. Actions could be
read (the default), skip, or recurse (reads all
files under each directory, recursively).
-H, --with-filename Print the filename for each match.
-h, --no-filename or --label=LABEL Actions could be to suppress the prefixing
filename on output or print the LABEL as a
filename for standard input.
-I Equivalent to --binary-files=without-
match.
-L, files-without-match Only print the filenames containing no match.
-l, --files-with-matches Only print the filenames containing matches.
-m, --max-count=NUM Stop after NUM matches.
-NUM, --color[=WHEN] or Same as --context=NUM.
--colour[=WHEN]
Use markers to distinguish the matching
string. The WHEN argument can be always,
never, or auto.
-n, --line-number or --line-buff Print the line number with output lines or flush
ered the output on each line.
-o, --only-matching Show only the part of a line that matches the
specified PATTERN.
-q, --quiet, --silent, or Suppress all normal output (first two), or
--binary-files=TYPE assume that binary files are TYPE, that can be:
• binary
• text
• without-match

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 13


Use the CLI

Table 8 Grep Output and Context Control Options


Syntax Element Output
-R, -r, --recursive Equivalent to --directories=recurse.
The possibilities are:
• --include=PATTERN—only files that
match the PATTERN are examined.
• --exclude=PATTERN—only files that
match the PATTERN are skipped.
• --exclude-from=FILE—files that match
the PATTERN in FILE are skipped.
-U, --binary Do not strip CR characters at the end of lines
(MSDOS format).
-u, --unix-byte-offsets Report offsets as if CRs were not there
(MSDOS format).
-Z, --null Print 0 bytes after the filename.

1.2.12.3 Example of the show Command Displaying Lines before and after a
Pattern

The following example displays all lines from the output for the show
configuration command (in any mode) beginning with the line before the
first line that contains the word (pattern), ospf, and including the 6 lines after
the first occurrence of the pattern.
[local]Ericsson#show configuration | begin before 1 after 6 ospf
router ospf 64001
spf-timers 1 1
area 0.0.0.0
interface 10.100.11.10
area 0.0.0.11
interface 10.100.11.27
interface 10.100.11.49

1.2.12.4 Example of the show Command Displaying Lines that Include a Pattern

The following example displays all lines in the current configuration file that
contain the word (pattern), card:
[local]Ericsson#show configuration | include card
card lc-1-10ge-20-8-port

1.2.12.5 Example of the show Command Displaying Lines that Match a grep
Pattern

The following example takes the output of the show port counters
command with the live keyword and pipes it into the grep command. Next,
the grep command filters what it receives and outputs only the lines that
contain ethernet, or rate. (The -E option interprets the pattern as an

14 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

extended regular expression where the pipe character (| ) is a logical OR


operator.) The output of the grep command is received by the exclude
keyword, which removes all lines containing the pattern interval and outputs
the remainder to the display.
[local]Ericsson#show port counters live | grep option -E
'ethernet|rate' | exclude interval
1/1 ethernet
send packet rate : 0.00 send bit rate : 0.00
recv packet rate : 0.00 recv bit rate : 0.00
1/2 ethernet
send packet rate : 0.00 send bit rate : 0.00
recv packet rate : 0.00 recv bit rate : 0.00
1/3 ethernet
send packet rate : 10011.15 send bit rate : 63687071.70
recv packet rate : 11.05 recv bit rate : 5936.04
1/4 ethernet
send packet rate : 0.00 send bit rate : 0.00
recv packet rate : 0.00 recv bit rate : 0.00
1/5 ethernet
send packet rate : 0.00 send bit rate : 0.00
recv packet rate : 0.00 recv bit rate : 0.00
1/6 ethernet
send packet rate : 10001.15 send bit rate : 63681368.88
recv packet rate : 16656.29 recv bit rate : 106066922.76
1/7 ethernet
send packet rate : 0.00 send bit rate : 0.00
recv packet rate : 0.00 recv bit rate : 0.00
1/8 ethernet
send packet rate : 84762.05 send bit rate : 239846234.73
recv packet rate : 515.15 recv bit rate : 516957.03
1/9 ethernet
send packet rate : 72380.47 send bit rate : 304731850.02
recv packet rate : 73368.28 recv bit rate : 131042073.08
1/10 ethernet
send packet rate : 1000.14 send bit rate : 3936558.36
recv packet rate : 1001.98 recv bit rate : 3968880.89
1/11 ethernet
send packet rate : 48828.55 send bit rate : 239393671.07
recv packet rate : 667.47 recv bit rate : 321245.22
1/12 ethernet
send packet rate : 77992.43 send bit rate : 637337147.78
recv packet rate : 69447.41 recv bit rate : 136675410.97

1.2.12.6 Example of the show Command Displaying Lines using the join-lines
Keyword

The following examples display various ways the join-lines keyword can be
used to output record entries.

The following output is that of the show circuit counters command


without the join-lines keyword.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 15


Use the CLI

[local]Ericsson#show circuit counters


Circuit Packets/Bytes Sent Packets/Bytes Received
1/1 0 0
0 0
1/2:1 0 0
0 0
1/3 0 0
0 0
1/4 0 0
0 0
1/5 0 6
0 360
1/6 0 0
0 0
1/7 0 0
0 0

When the exclude pattern keyword is piped with the join-lines keyword,
the record(s) that does not contain the pattern 2 is output.

[local]Ericsson#show circuit counters | join-lines | exclude 2


Circuit Packets/Bytes Sent Packets/Bytes Received
1/1 0 0
0 0
1/3 0 0
0 0
1/4 0 0
0 0
1/5 0 6
0 360
1/6 0 0
0 0
1/7 0 0
0 0

1.2.13 Configuring a Command Alias


A command alias is a character string that you can use in place of a command
string. Use aliases to create shortcuts for frequently used commands.

1.2.13.1 Configure a CLI Command Alias

Each command has a privilege level that determines, given the privilege
assigned to the administrator, who can enter the command.

To define the alias for a CLI command, perform the task described in Table 9.
Enter the command in global configuration mode.

Table 9 Configure a CLI Command Alias


Task Root Command
Define an alias for a command. alias

Note: To disable alias processing for a particular command, begin the


command line with the backslash (\) character.

16 1/190 80-AXI 101 09/1 Uen B | 2016-05-13


Use the CLI

Caution!
Risk of disabled commands. It is possible to create an alias that disables
existing commands. To reduce the risk, use care when you define aliases.
Avoid defining an alias name that is a command keyword or a partial keyword
for the CLI. Aliases apply to all users on a system.

1.2.13.2 Command Alias

The following example defines the string, pc, as a shortcut for the show port
counters command and then demonstrates the use of the new alias.
[local]Ericsson(config)#alias inherit pc show port counters
[local]Ericsson(config)#end
[local]Ericsson#pc 1/1

Port Type Pkts/Bytes Sent Pkts/Bytes Received


1/1 lc-1-10ge-20-8-port 0 0

For more information on the show port counters command, see the
Command List.

1.2.14 Creating a Command Macro


A command macro is an extended alias that allows you to define a sequence
of commands to run with the macro name instead of entering each command
separately.

To create a macro for one or more CLI commands, perform the tasks described
in Table 10.

Table 10 Create a CLI Command Macro


Task Root Command Notes
1. Define a macro and enter macro macro Enter this command in global
configuration mode. configuration mode.
2. Specify a command in the macro. seq Enter this command in macro
configuration mode. Use this
command for each command to be
included in the macro.
3. Complete the macro. exit Enter this command in all modes.

1.2.14.1 Configure a Command Macro

The following example defines the show-port-all macro.

1/190 80-AXI 101 09/1 Uen B | 2016-05-13 17


Use the CLI

[local]Ericsson(config)#macro inherit show-port-all


[local]Ericsson(config-macro)#seq 10 show port $1/$2
[local]Ericsson(config-macro)#seq 20 show circuit $1/$2
[local]Ericsson(config-macro)#exit

The following example displays port data for port 3 of the traffic card in slot 1
using the same macro.
[local]Ericsson>show-port-all 1 3

18 1/190 80-AXI 101 09/1 Uen B | 2016-05-13

You might also like