1 .. _cli_getting_started:
3 Getting Started with the debug CLI
4 ==================================
6 The VPP network stack comes equipped with a set of commands that are useful
9 The easiest way to access the CLI (with proper permissions) is to use the
12 .. code-block:: console
14 sudo vppctl <cli-command>
17 The CLI parser matches static keyword strings, eventually invoking an action
18 function. Unambiguous partial keyword matching always occurs. The action
19 functions consume input until satisfied or until they fail. This model makes
20 for easy coding, but does not guarantee useful "help" output. It's up to the
21 CLI command writer to add useful help strings.
23 You can find the source code of CLI commands by searching for instances of the
24 ``VLIB_CLI_COMMAND`` macro in the code source files.
26 Please help maintain and improve this document to make and keep these commands
34 The debug CLI is enabled with the unix interactive parameter or startup
35 configuration option. This causes VPP to start without daemonizing and
36 presents a command line interface on the terminal where it is run.
38 The Telnet CLI is enabled with the ``cli-listen localhost:5002`` option which
39 will cause VPP to listen for TCP connections on the localhost address port
40 ``5002``. A Telnet client can then connect to this port (for example, ``telnet
41 localhost 5002``) and will receive a command line prompt.
43 This configuration will enable both mechanisms:
45 .. code-block:: console
49 cli-listen localhost:5002
53 The debug CLI can operate in line mode, which may be useful when running
54 inside an IDE like Emacs. This is enabled with the option
55 ``unix cli-line-mode``. Several other options exist that alter how this
56 CLI works, see the @ref syscfg section for details.
58 The CLI starts with a banner graphic (which can be disabled) and a prompt. The
59 prompt will typically read ``vpp`` for a release version of VPP and ``DBGvpp#``
60 for a development version with debugging enabled, for example:
62 .. code-block:: console
65 __/ __/ _ \ (_)__ | | / / _ \/ _ \
66 _/ _// // / / / _ \ | |/ / ___/ ___/
67 /_/ /____(_)_/\___/ |___/_/ /_/
75 .. code-block:: console
78 __/ __/ _ \ (_)__ | | / / _ \/ _ \
79 _/ _// // / / / _ \ | |/ / ___/ ___/
80 /_/ /____(_)_/\___/ |___/_/ /_/
85 This prompt can be configured with the ``unix cli-prompt`` setting and the
86 banner is disabled with ``unix cli-no-banner``.
93 The CLI has several editing features that make it easy to use.
95 - Cursor keys ``left/right`` will move the cursor within a command line;
96 typing will insert at the cursor; erase will erase at the cursor.
98 - ``Ctrl-left/right`` will search for the start of the next word to
100 - ``Home/end`` will jump the cursor to the start and end of the line.
101 - Cursor keys up/down and ``^P/^N`` iterate through the command history
102 buffer. Lines from the history buffer may be edited. New commands
103 are added to the end of the buffer when executed; though
104 duplicates of the previous command are not added.
105 - ``^U`` erases the line contents from the left of the cursor to the
107 - ``^K`` erases the contents from the cursor to the end.
108 - ``^S/^R`` will search the command history forwards or in reverse for
109 a command; start typing for matches to auto complete.
110 - ``^L`` will clear the screen (if supported by the terminal) and repaint
111 the prompt and any current line. The cursor position is also
113 - The CLI can be closed with the quit command. Alternatively, ``^D`` on
114 an empty input line will also close the session. Closing the debug
115 session will also shutdown VPP.
117 Output that exceeds the length of a terminal page will be buffered, up to a
120 - ``Space`` or ``page-down`` displays the next page.
121 - ``Enter`` or ``down-arrow`` displays the next line.
122 - ``Page-up`` goes back a page.
123 - ``Up-arrow`` goes up a line.
124 - ``Home/end`` jump to the start/end of the buffered output.
125 - The key ``q`` quits the pager. ``Space`` and ``enter`` will also quit the
126 pager if the end of the buffer has been reached.