XOS: How to create CLI aliases / shortcuts ?


Userlevel 6
Is it possible to create command shortcuts for commands which are often used or cumbersome to type in ? Like other major vendors "alias exec scn show cdp neighbor" ?
I guess with recent XOS the scripting feature should make this possible.

If someone use this - it is very welcome.

Regards

9 replies

Userlevel 6
You can do it in python or cli scripting , but you would still need to type "load script cdp" to execute the command if the script file was cdp.py or cdp.xsf

Is that what your looking for?
Userlevel 6
OK. Scripting will help me with long commands. Is it possible to commit parameter to the script ?

And what about when i will create a shortcut for fewer command typing ? Like for example "sln" for show lldp neighbors ?

Regards
Userlevel 7
M.Nees wrote:

OK. Scripting will help me with long commands. Is it possible to commit parameter to the script ?

And what about when i will create a shortcut for fewer command typing ? Like for example "sln" for show lldp neighbors ?

Regards

Hi Matthias,

You can pass CLI arguments to scripts. You can find an example of this with a Python script here:
https://github.com/extremenetworks/ExtremeScripting/blob/master/EXOS/Python/watch/watch.py

-Brandon
Userlevel 5
Something like that would definitely be a "nice to have"; I could alias "save" to "wr" for my cisco-centric cow-orkers 🙂
Userlevel 6
Review after 2 years!

Since EXOS V22.3 we have the needed command:

https://documentation.extremenetworks.com/exos_22.4/exos_21_1/exos_commands_all/r_alias.shtml

Regards
Userlevel 7
M.Nees wrote:

Review after 2 years!

Since EXOS V22.3 we have the needed command:

https://documentation.extremenetworks.com/exos_22.4/exos_21_1/exos_commands_all/r_alias.shtml

Regards

Completely forgot about this topic. Glad you found it and brought it back to life 🙂
Userlevel 5
EXOS 22.3 and later can store commands like 'alias' in a exshrc.xsf script on a switch. This script is run after a successful login, Similar concept to the linux .bashrc file after a linux login.

This is a way to make aliases available to any login by storing the alias commands in this file.

exshrc.xsf is stored in /usr/local/cfg

Because this is a .xsf file and follows the EXOS .xsf scripting rules, the exshrc.xsf file can be any script you would like to run after a login is successful.
Userlevel 6
Dave Hammers wrote:

EXOS 22.3 and later can store commands like 'alias' in a exshrc.xsf script on a switch. This script is run after a successful login, Similar concept to the linux .bashrc file after a linux login.

This is a way to make aliases available to any login by storing the alias commands in this file.

exshrc.xsf is stored in /usr/local/cfg

Because this is a .xsf file and follows the EXOS .xsf scripting rules, the exshrc.xsf file can be any script you would like to run after a login is successful.

Hi Dave,

that is a very very interesting advice not only regarding to aliases.
There a lot of possible use cases.

(This works well ...)

Thanks for emphasing that!

Regards,
Matthias
Userlevel 7
I was asked to come up with some other use cases for exshrc.xsf besides aliases.

I could see this being use for setting session-specific variables.
disable clipaging and configure cli are good examples.

What other ideas does the community have?

Reply