UNPKG

1.74 kBMarkdownView Raw
1dmesg
2===
3
4显示Linux系统启动信息
5
6## 补充说明
7
8**dmesg命令** 被用于检查和控制内核的环形缓冲区。kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息保存在`/var/log/dmesg`文件里。
9
10### 语法
11
12```shell
13dmesg(选项)
14```
15
16### 选项
17
18```shell
19-c:显示信息后,清除ring buffer中的内容;
20-s<缓冲区大小>:预设置为8196,刚好等于ring buffer的大小;
21-n:设置记录信息的层级。
22```
23
24### 实例
25
26```shell
27[root@localhost ~]# dmesg | head
28Linux 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
29BIOS-provided physical RAM map:
30 BIOS-e820: 0000000000010000 - 000000000009f400 (usable)
31 BIOS-e820: 000000000009f400 - 00000000000a0000 (reserved)
32 BIOS-e820: 00000000000f0000 - 0000000000100000 (reserved)
33 BIOS-e820: 0000000000100000 - 000000007f590000 (usable)
34 BIOS-e820: 000000007f590000 - 000000007f5e3000 (ACPI NVS)
35 BIOS-e820: 000000007f5e3000 - 000000007f5f0000 (ACPI data)
36 BIOS-e820: 000000007f5f0000 - 000000007f600000 (reserved)
37 BIOS-e820: 00000000e0000000 - 00000000e8000000 (reserved)
38```
39
40查看硬盘基础信息
41
42```shell
43dmesg | grep sda
44
45[ 2.442555] sd 0:0:0:0: [sda] 488281250 512-byte logical blocks: (250 GB/232 GiB)
46[ 2.442590] sd 0:0:0:0: [sda] Write Protect is off
47[ 2.442592] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
48[ 2.442607] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
49[ 2.447533] sda: sda1
50[ 2.448503] sd 0:0:0:0: [sda] Attached SCSI disk
51```
52
53