2019-04-21 11:50:48 +08:00

33 lines
2.7 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="dmesg">dmesg</h1>
<p>显示Linux系统启动信息</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>dmesg命令</strong> 被用于检查和控制内核的环形缓冲区。kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息可利用dmesg来查看。开机信息保存在<code>/var/log/dmesg</code>文件里。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">dmesg(选项)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-c显示信息后清除ring buffer中的内容
-s&lt;缓冲区大小&gt;预设置为8196刚好等于ring buffer的大小
-n设置记录信息的层级。</code></pre>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">[root@localhost ~]# dmesg | head
Linux version 2.6.18-348.6.1.el5 (mockbuild@builder17.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-54)) #1 SMP Tue May 21 15:34:22 EDT 2013
BIOS-provided physical RAM map:
BIOS-e820: 0000000000010000 - 000000000009f400 (usable)
BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
BIOS-e820: 0000000000100000 - 000000007f590000 (usable)
BIOS-e820: 000000007f590000 - 000000007f5e3000 (ACPI NVS)
BIOS-e820: 000000007f5e3000 - 000000007f5f0000 (ACPI data)
BIOS-e820: 000000007f5f0000 - 000000007f600000 (reserved)
BIOS-e820: 00000000e0000000 - 00000000e8000000 (reserved)</code></pre>
<p>查看硬盘基础信息</p>
<div class="sourceCode" id="cb4"><pre><code class="language-bash"><a class="sourceLine" id="cb4-1" data-line-number="1"><span class="fu">dmesg</span> <span class="kw">|</span> <span class="fu">grep</span> sda</a>
<a class="sourceLine" id="cb4-2" data-line-number="2"></a>
<a class="sourceLine" id="cb4-3" data-line-number="3"><span class="bu">[</span> 2.442555] sd 0:0:0:0: [sda] 488281250 512-byte logical blocks: (250 GB/232 GiB)</a>
<a class="sourceLine" id="cb4-4" data-line-number="4">[ 2.442590] sd 0:0:0:0: [sda] Write Protect is off</a>
<a class="sourceLine" id="cb4-5" data-line-number="5">[ 2.442592] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00</a>
<a class="sourceLine" id="cb4-6" data-line-number="6">[ 2.442607] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn<span class="st">&#39;t support DPO or FUA</span></a>
<a class="sourceLine" id="cb4-7" data-line-number="7"><span class="st">[ 2.447533] sda: sda1</span></a>
<a class="sourceLine" id="cb4-8" data-line-number="8"><span class="st">[ 2.448503] sd 0:0:0:0: [sda] Attached SCSI disk</span></a></code></pre></div>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->