alias

Syntax

alias <name> <command>

no alias <name> <command>

Description

The alias command creates a shortcut alias name that can be used in place of a CLI command to simplify keystrokes and aid memory. The alias command is executed from the current configuration context.

Options

no

Specifies that the alias for the command is to be removed.

Specifiers

<name>

Specifies the alias for the CLI command. The alias name must not be an existing CLI command.

<command>

Specifies an existing CLI command for which to create the alias. The command must be enclosed in quotes.

It is recommended that you use an alias that does not have an existing tab completion in the CLI. For example, using an alias that starts with "show" or "int" would complete to "show" and "interface" respectively when you use the tab completion function.

Privilege

The alias command is executed from the current configuration context (operator, manager, or global). If the command that is aliased has to be executed in the global configuration context, you must execute the alias for that command in the global configuration context. This prevents bypassing the security for a particular context.

Restrictions

  • The alias name must not be an existing CLI command. Existing CLI commands are searched before looking for an alias command; an alias that is identical to an existing command will not be executed.

  • Hewlett Packard Enterprise recommends that you configure no more than 128 aliases.

Example

This example shows the creation and use of an alias for the show int custom command to demonstrate how a command alias can simplify keystrokes when entering a command. The actual show int custom command is used first and then an alias is created for it and then used.

switch(config)# show int custom 1-4 port name:4 type vlan intrusion speed
enabled mdi

 Status and Counters - Custom Port Status

                               Intrusion
Port Name     Type       VLAN  Alert     Speed   Enabled MDI-mode
---- -------- ---------- ----- --------- ------- ------- -------
1    Acco     100/1000T  1     No        1000FDx Yes     Auto
2    Huma     100/1000T  1     No        1000FDx Yes     Auto
3    Deve     100/1000T  1     No        1000FDx Yes     Auto
4    Lab1     100/1000T  1     No        1000FDx Yes     Auto


switch(config)# alias sic "show int custom 1-4 port name:4 type vlan intrusion
speed enabled mdi"
switch(config)#

switch(config)# sic 

Status and Counters - Custom Port Status

                               Intrusion
Port Name     Type       VLAN  Alert     Speed   Enabled MDI-mode
---- -------- ---------- ----- --------- ------- ------- -------
1    Acco     100/1000T  1     No        1000FDx Yes     Auto
2    Huma     100/1000T  1     No        1000FDx Yes     Auto
3    Deve     100/1000T  1     No        1000FDx Yes     Auto
4    Lab1     100/1000T  1     No        1000FDx Yes     Auto