docs: better docs, mv doxygen to sphinx
[vpp.git] / docs / cli-reference / gettingstarted / index.rst
1 .. _cli_getting_started:
2
3 Getting Started with the debug CLI
4 ==================================
5
6 The VPP network stack comes equipped with a set of commands that are useful
7 for debugging.
8
9 The easiest way to access the CLI (with proper permissions) is to use the
10 vppctl command:
11
12 .. code-block:: console
13
14     sudo vppctl <cli-command>
15
16
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.
22
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.
25
26 Please help maintain and improve this document to make and keep these commands
27 clear and useful!
28
29 .. _debug_telnet_cli:
30
31 Debug and Telnet CLI
32 --------------------
33
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.
37
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.
42
43 This configuration will enable both mechanisms:
44
45 .. code-block:: console
46
47     unix {
48       interactive
49       cli-listen localhost:5002
50     }
51
52
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.
57
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:
61
62 .. code-block:: console
63
64         _______    _        _   _____  ___
65      __/ __/ _ \  (_)__    | | / / _ \/ _ \
66      _/ _// // / / / _ \   | |/ / ___/ ___/
67      /_/ /____(_)_/\___/   |___/_/  /_/
68
69     vpp#
70
71
72
73 versus:
74
75 .. code-block:: console
76
77         _______    _        _   _____  ___
78      __/ __/ _ \  (_)__    | | / / _ \/ _ \
79      _/ _// // / / / _ \   | |/ / ___/ ___/
80      /_/ /____(_)_/\___/   |___/_/  /_/
81
82     DBGvpp#
83
84
85 This prompt can be configured with the ``unix cli-prompt`` setting and the
86 banner is disabled with ``unix cli-no-banner``.
87
88 .. _cli_features:
89
90 CLI features
91 ------------
92
93 The CLI has several editing features that make it easy to use.
94
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.
97
98 - ``Ctrl-left/right`` will search for the start of the next word to
99   the left or right.
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
106   start.
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
112   retained.
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.
116
117 Output that exceeds the length of a terminal page will be buffered, up to a
118 limit.
119
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.