info_i_25x25.png Due to unforeseen weather conditions we are experiencing higher chat wait times. Remember you can also submit a ticket and one of our support representatives will get back to you as soon as possible. We apologize for the inconvenience.

EdgeRouter - Add commands to EdgeOS


You can add simple commands to EdgeOS. For example, reset is a top-level EdgeOS command that is not available in the CLI.


For this example, we'll add a command to reset the console.

  1. When first running the reset command, a single option exists.

    1. [email protected]:~$ reset ?
  2. To add commands, it's necessary to become the root user. The sudo command is used to gain root user privileges.

    [email protected]:~$ sudo bash
    [email protected]:/home/ubnt#
  3. Now as root user, navigate to the directory with all of the operational mode templates.

    1. [email protected]:/home/ubnt# cd /opt/vyatta/share/vyatta-op/templates
      [email protected]:/opt/vyatta/share/vyatta-op/templates# ls
      add            delete         ping6          reset          terminal
      clear          disconnect     reboot         restart        traceroute
      configure      generate       release        set            traceroute6
      connect        initial-setup  remove         show           undebug
      copy           no             rename         shutdown       update
      debug          ping           renew          telnet
  4. Go to the reset directory and create a reset sub-command.

    [email protected]:/opt/vyatta/share/vyatta-op/templates# cd reset
    [email protected]:/opt/vyatta/share/vyatta-op/templates/reset# ls
    node.def  openvpn
  5. Use the mkdir command to create a directory called console.

    [email protected]:/opt/vyatta/share/vyatta-op/templates/reset# mkdir console
    [email protected]:/opt/vyatta/share/vyatta-op/templates/reset# cd console
  6. While in root, use the cat (concatenate) command to create a file named node.def in the console directory. Add the lines "help..." and "run..." as listed below. Hit enter then press ctrl + c to finish editing the file.

    [email protected]:/opt/vyatta/share/vyatta-op/templates/reset/console# cat > node.def
    help: Reset the console
    run: /usr/bin/reset
  7. Exit out of root and try out the new command:

  8. [email protected]:/opt/vyatta/share/vyatta-op/templates/reset/console# exit
    [email protected]:~$ reset ?        
    console  openvpn  
    [email protected]:~$ reset ?
    Possible completions:
      console       Reset the console
      openvpn       Reset OpenVPN 
    [email protected]:~$ reset console