ExtremeSwitching (EXOS)

Expand all | Collapse all

XOS: How to create CLI aliases / shortcuts ?

  • 1.  XOS: How to create CLI aliases / shortcuts ?

    Posted 12-15-2015 15:33
    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


  • 2.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 12-15-2015 15:42
    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?


  • 3.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 12-15-2015 16:00
    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


  • 4.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 12-16-2015 08:52
    Something like that would definitely be a "nice to have"; I could alias "save" to "wr" for my cisco-centric cow-orkers :)


  • 5.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 02-24-2018 20:41
    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.


  • 6.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 03-29-2018 15:19
    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?


  • 7.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 12-15-2015 16:00
    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


  • 8.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 02-22-2018 08:11
    Completely forgot about this topic. Glad you found it and brought it back to life :)


  • 9.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 02-24-2018 20:41
    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


  • 10.  RE: XOS: How to create CLI aliases / shortcuts ?

    Posted 02-22-2018 08:11
    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