1# dmesg 2 3## Command Function<a name="section4643204919313"></a> 4 5This command is used to display system boot and running information. 6 7## Syntax<a name="section6553153635"></a> 8 9dmesg 10 11dmesg \[_-c/-C/-D/-E/-L/-U_\] 12 13dmesg -s \[_size_\] 14 15dmesg -l \[_level_\] 16 17dmesg \> \[_fileA_\] 18 19## Parameters<a name="section208971157532"></a> 20 21**Table 1** Parameter description 22 23<a name="table3900mcpsimp"></a> 24<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> 25</th> 26<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> 27</th> 28<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> 29</th> 30</tr> 31</thead> 32<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> 33</td> 34<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> 35</td> 36<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> 37</td> 38</tr> 39<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> 40</td> 41<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> 42</td> 43<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> 44</td> 45</tr> 46<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> 47</td> 48<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3931mcpsimp"><a name="p3931mcpsimp"></a><a name="p3931mcpsimp"></a>Disables or enables printing to the console.</p> 49</td> 50<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> 51</td> 52</tr> 53<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> 54</td> 55<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p3938mcpsimp"><a name="p3938mcpsimp"></a><a name="p3938mcpsimp"></a>Disables or enables printing via the serial port.</p> 56</td> 57<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> 58</td> 59</tr> 60<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> 61</td> 62<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> 63</td> 64<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> 65</td> 66</tr> 67<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> 68</td> 69<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> 70</td> 71<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> 72</td> 73</tr> 74<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>> fileA</p> 75</td> 76<td class="cellrowborder" valign="top" width="52%" headers="mcps1.2.4.1.2 "><p id="p717417317512"><a name="p717417317512"></a><a name="p717417317512"></a>Writes the content in the buffer to the specified file.</p> 77</td> 78<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> 79</td> 80</tr> 81</tbody> 82</table> 83 84## Usage<a name="section213115219413"></a> 85 86- This command depends on **LOSCFG\_SHELL\_DMESG**. Before using this command, select **Enable Shell dmesg** on **menuconfig**. 87 88 Debug ---\> Enable a Debug Version ---\> Enable Shell ---\> Enable Shell dmesg 89 90- If no parameter is specified, all content in the buffer is printed. 91- The parameters followed by hyphens \(-\) are mutually exclusive. 92 1. Before writing content to a file, ensure that the file system has been mounted. 93 2. Disabling the serial port printing will adversely affect shell. You are advised to set up a connection using Telnet before disabling the serial port. 94 95 96## Example<a name="section13736564418"></a> 97 98Run **dmesg\> dmesg.log**. 99 100## Output<a name="section194005101413"></a> 101 102Writing the content in the buffer to the **dmesg.log** file: 103 104``` 105OHOS # dmesg > dmesg.log 106Dmesg write log to dmesg.log success 107``` 108 109