# Asterisk Project : Simple CLI Tricks

Added by malcolmd , edited by mdavenport on Sep 23, 2010

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

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.

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>

As you can see, there's a wealth of information available from the Asterisk command-line interface, and we've only scratched the surface. In later sections, we'll go into more details about how to use the command-line interface for other purposes.