Skip to end of metadata
Go to start of metadata

Quit Typing the Whole Command

There are a couple of tricks that will help you on the Asterisk command-line interface. The most popular is tab completion. If you type the beginning of a command and press the Tab key, Asterisk will attempt to complete the name of the command for you, or show you the possible commands that start with the letters you have typed. For example, type co and then press the Tab key on your keyboard.

server*CLI> co[Tab]
config core
server*CLI> co

Now press the r key, and press tab again. This time Asterisk completes the word for you, as core is the only command that begins with cor. This trick also works with sub-commands. For example, type core show and press tab. (You may have to press tab twice, if you didn't put a space after the word show.) Asterisk will show you all the sub-commands that start with core show.

server*CLI> core show [Tab]
application     applications    calls           channel
channels        channeltype     channeltypes    codec
codecs          config          file            function
functions       help            hint            hints
image           license         profile         settings
switches        sysinfo         taskprocessors  threads
translation     uptime          version         warranty
server*CLI> core show

Repeat Previous Commands

Another trick you can use on the CLI is to cycle through your previous commands. Asterisk stores a history of the commands you type and you can press the up arrow key to cycle through the history.

Run Linux Shell Commands from The Asterisk CLI

If you type an exclamation mark at the Asterisk CLI, you will get a Linux shell. When you exit the Linux shell (by typing exit or pressing Ctrl+D), you return to the Asterisk CLI. You can also type an exclamation mark and a Linux command, and the output of that command will be shown to you, and then you'll be returned to the Asterisk CLI.

server*CLI> !whoami
root
server*CLI>
  • No labels