EdgeRouter - Add Commands to EdgeOS


Overview


Readers will learn how to add custom commands to the EdgeOS command line.

NOTES & REQUIREMENTS:
Applicable to the latest EdgeOS firmware on all EdgeRouter models. Please see the Related Articles below for more information.
 
Device used in this article:

Adding Custom Commands


Back to Top

In this example, an operational mode command is added to the command line that resets the console session (clear screen)

CLI: Access the command line interface (CLI). You can do this using the CLI button in the GUI or by using a program such as PuTTY.

When first running the reset command, a single option exists:

ubnt@edgerouter:~$ reset ?
Possible completions:
openvpn Reset OpenVPN

1. Log in as the root user.

sudo su

2. Navigate to the /opt/vyatta/share/vyatta-op/templates/reset directory.

cd /opt/vyatta/share/vyatta-op/templates/reset
NOTE: Commands added to the reset sub-directory will add them to the reset ? command tree.

3. Create a new directory named console.

mkdir console

4. Navigate to the newly created console directory.

cd console

5. Create a new file named node.def in the console directory and add the following lines.

cat > node.def
help: Reset the Console
run: /usr/bin/reset

6. Use CTRL + C to save the output.

7. Return to operational mode.

exit

 

Verify the configuration by trying out the new command:

ubnt@edgerouter:~$ reset ?
Possible completions:
console Reset the Console
openvpn Reset OpenVPN

ubnt@edgerouter:~$ reset console

Related Articles


Back to Top

Intro to Networking - How to Establish a Connection Using SSH


We're sorry to hear that!