• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# dmesg<a name="EN-US_TOPIC_0000001179845915"></a>
2
3-   [Command Function](#section4643204919313)
4-   [Syntax](#section6553153635)
5-   [Parameters](#section208971157532)
6-   [Usage](#section213115219413)
7-   [Example](#section13736564418)
8-   [Output](#section194005101413)
9
10## Command Function<a name="section4643204919313"></a>
11
12This command is used to control the dmesg buffer of the kernel.
13
14## Syntax<a name="section6553153635"></a>
15
16dmesg
17
18dmesg \[_-c/-C/-D/-E/-L/-U_\]
19
20dmesg -s \[_size_\]
21
22dmesg -l \[_level_\]
23
24dmesg \> \[_fileA_\]
25
26## Parameters<a name="section208971157532"></a>
27
28**Table  1**  Parameter description
29
30<a name="table3900mcpsimp"></a>
31<table><thead align="left"><tr id="row3906mcpsimp"><th class="cellrowborder" valign="top" width="21%" id="mcps1.2.4.1.1"><p id="p3908mcpsimp"><a name="p3908mcpsimp"></a><a name="p3908mcpsimp"></a>Parameter</p>
32</th>
33<th class="cellrowborder" valign="top" width="52%" id="mcps1.2.4.1.2"><p id="p3910mcpsimp"><a name="p3910mcpsimp"></a><a name="p3910mcpsimp"></a>Description</p>
34</th>
35<th class="cellrowborder" valign="top" width="27%" id="mcps1.2.4.1.3"><p id="p3912mcpsimp"><a name="p3912mcpsimp"></a><a name="p3912mcpsimp"></a>Value Range</p>
36</th>
37</tr>
38</thead>
39<tbody><tr id="row3913mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3915mcpsimp"><a name="p3915mcpsimp"></a><a name="p3915mcpsimp"></a>-c</p>
40</td>
41<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3917mcpsimp"><a name="p3917mcpsimp"></a><a name="p3917mcpsimp"></a>Prints content in the buffer and clears the buffer.</p>
42</td>
43<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3919mcpsimp"><a name="p3919mcpsimp"></a><a name="p3919mcpsimp"></a>N/A</p>
44</td>
45</tr>
46<tr id="row3920mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3922mcpsimp"><a name="p3922mcpsimp"></a><a name="p3922mcpsimp"></a>-C</p>
47</td>
48<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3924mcpsimp"><a name="p3924mcpsimp"></a><a name="p3924mcpsimp"></a>Clears the buffer.</p>
49</td>
50<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3926mcpsimp"><a name="p3926mcpsimp"></a><a name="p3926mcpsimp"></a>N/A</p>
51</td>
52</tr>
53<tr id="row3927mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3929mcpsimp"><a name="p3929mcpsimp"></a><a name="p3929mcpsimp"></a>-D/-E</p>
54</td>
55<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3931mcpsimp"><a name="p3931mcpsimp"></a><a name="p3931mcpsimp"></a>Enables or disables printing to the console.</p>
56</td>
57<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3933mcpsimp"><a name="p3933mcpsimp"></a><a name="p3933mcpsimp"></a>N/A</p>
58</td>
59</tr>
60<tr id="row3934mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3936mcpsimp"><a name="p3936mcpsimp"></a><a name="p3936mcpsimp"></a>-L/-U</p>
61</td>
62<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3938mcpsimp"><a name="p3938mcpsimp"></a><a name="p3938mcpsimp"></a>Enables or disables printing via the serial port.</p>
63</td>
64<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3940mcpsimp"><a name="p3940mcpsimp"></a><a name="p3940mcpsimp"></a>N/A</p>
65</td>
66</tr>
67<tr id="row3941mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3943mcpsimp"><a name="p3943mcpsimp"></a><a name="p3943mcpsimp"></a>-s size</p>
68</td>
69<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3945mcpsimp"><a name="p3945mcpsimp"></a><a name="p3945mcpsimp"></a>Sets the size of the buffer.</p>
70</td>
71<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3947mcpsimp"><a name="p3947mcpsimp"></a><a name="p3947mcpsimp"></a>N/A</p>
72</td>
73</tr>
74<tr id="row3948mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3950mcpsimp"><a name="p3950mcpsimp"></a><a name="p3950mcpsimp"></a>-l level</p>
75</td>
76<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3952mcpsimp"><a name="p3952mcpsimp"></a><a name="p3952mcpsimp"></a>Sets the buffering level.</p>
77</td>
78<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3954mcpsimp"><a name="p3954mcpsimp"></a><a name="p3954mcpsimp"></a>0 - 5</p>
79</td>
80</tr>
81<tr id="row3955mcpsimp"><td class="cellrowborder" valign="top" width="21%" headers="mcps1.2.4.1.1 "><p id="p3957mcpsimp"><a name="p3957mcpsimp"></a><a name="p3957mcpsimp"></a>&gt; fileA</p>
82</td>
83<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3959mcpsimp"><a name="p3959mcpsimp"></a><a name="p3959mcpsimp"></a>Writes the content in the buffer to a file.</p>
84</td>
85<td class="cellrowborder" valign="top" width="27%" headers="mcps1.2.4.1.3 "><p id="p3961mcpsimp"><a name="p3961mcpsimp"></a><a name="p3961mcpsimp"></a>N/A</p>
86</td>
87</tr>
88</tbody>
89</table>
90
91## Usage<a name="section213115219413"></a>
92
93-   This command depends on  **LOSCFG\_SHELL\_DMESG**. Before using this command, select  **Enable Shell dmesg**  on  **menuconfig**.
94
95    Debug  ---\> Enable a Debug Version ---\> Enable Shell ---\> Enable Shell dmesg
96
97-   If the parameters are not specified, all content in the buffer is printed.
98-   The parameters followed by hyphens \(-\) are mutually exclusive.
99    1.  Before writing content to a file, ensure that the file system has been mounted.
100    2.  Disabling the serial port printing will adversely affect the shell. You are advised to set up a connection using Telnet before disabling the serial port.
101
102
103## Example<a name="section13736564418"></a>
104
105Example:
106
107Run  **dmesg \> /usr/dmesg.log**.
108
109## Output<a name="section194005101413"></a>
110
111**Figure  1**  Writing dmesg content to a file<a name="fig11150135113566"></a>
112![](figure/writing-dmesg-content-to-a-file.png "writing-dmesg-content-to-a-file")
113
114