blob: 6528725de458f39d939c190a074a0130b55ab3d3 [file] [log] [blame]
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02001.. _cli_getting_started:
2
3Getting Started with the debug CLI
4==================================
5
6The VPP network stack comes equipped with a set of commands that are useful
7for debugging.
8
9The easiest way to access the CLI (with proper permissions) is to use the
10vppctl command:
11
12.. code-block:: console
13
14 sudo vppctl <cli-command>
15
16
17The CLI parser matches static keyword strings, eventually invoking an action
18function. Unambiguous partial keyword matching always occurs. The action
19functions consume input until satisfied or until they fail. This model makes
20for easy coding, but does not guarantee useful "help" output. It's up to the
21CLI command writer to add useful help strings.
22
23You 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
26Please help maintain and improve this document to make and keep these commands
27clear and useful!
28
29.. _debug_telnet_cli:
30
31Debug and Telnet CLI
32--------------------
33
34The debug CLI is enabled with the unix interactive parameter or startup
35configuration option. This causes VPP to start without daemonizing and
36presents a command line interface on the terminal where it is run.
37
38The Telnet CLI is enabled with the ``cli-listen localhost:5002`` option which
39will 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
41localhost 5002``) and will receive a command line prompt.
42
43This configuration will enable both mechanisms:
44
45.. code-block:: console
46
47 unix {
48 interactive
49 cli-listen localhost:5002
50 }
51
52
53The debug CLI can operate in line mode, which may be useful when running
54inside an IDE like Emacs. This is enabled with the option
55``unix cli-line-mode``. Several other options exist that alter how this
56CLI works, see the @ref syscfg section for details.
57
58The CLI starts with a banner graphic (which can be disabled) and a prompt. The
59prompt will typically read ``vpp`` for a release version of VPP and ``DBGvpp#``
60for a development version with debugging enabled, for example:
61
62.. code-block:: console
63
64 _______ _ _ _____ ___
65 __/ __/ _ \ (_)__ | | / / _ \/ _ \
66 _/ _// // / / / _ \ | |/ / ___/ ___/
67 /_/ /____(_)_/\___/ |___/_/ /_/
68
69 vpp#
70
71
72
73versus:
74
75.. code-block:: console
76
77 _______ _ _ _____ ___
78 __/ __/ _ \ (_)__ | | / / _ \/ _ \
79 _/ _// // / / / _ \ | |/ / ___/ ___/
80 /_/ /____(_)_/\___/ |___/_/ /_/
81
82 DBGvpp#
83
84
85This prompt can be configured with the ``unix cli-prompt`` setting and the
86banner is disabled with ``unix cli-no-banner``.
87
88.. _cli_features:
89
90CLI features
91------------
92
93The 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
117Output that exceeds the length of a terminal page will be buffered, up to a
118limit.
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.