From f6890531f8c4905896fa9f452ba0956cae42afe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=BC=9F=E8=B0=83=E8=B0=83=E2=84=A2?= <398188662@qq.com> Date: Mon, 17 Apr 2017 22:15:39 +0800 Subject: [PATCH] =?UTF-8?q?dmesg=E5=91=BD=E4=BB=A4=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- command/dmesg.md | 92 +++++++++++++++++++++++++++--------------------- 1 file changed, 52 insertions(+), 40 deletions(-) diff --git a/command/dmesg.md b/command/dmesg.md index f11ad2f351..be21352036 100644 --- a/command/dmesg.md +++ b/command/dmesg.md @@ -1,41 +1,53 @@ -dmesg -=== +dmesg +=== -显示Linux系统启动信息 - -## 补充说明 - -**dmesg命令** 被用于检查和控制内核的环形缓冲区。kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息保存在`/var/log/dmesg`文件里。 - -### 语法 - -``` -dmesg(选项) -``` - -### 选项 - -``` --c:显示信息后,清除ring buffer中的内容; --s<缓冲区大小>:预设置为8196,刚好等于ring buffer的大小; --n:设置记录信息的层级。 -``` - -### 实例 - -``` -[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) -``` - - - \ No newline at end of file +显示Linux系统启动信息 + +## 补充说明 + +**dmesg命令** 被用于检查和控制内核的环形缓冲区。kernel会将开机信息存储在ring buffer中。您若是开机时来不及查看信息,可利用dmesg来查看。开机信息保存在`/var/log/dmesg`文件里。 + +### 语法 + +``` +dmesg(选项) +``` + +### 选项 + +``` +-c:显示信息后,清除ring buffer中的内容; +-s<缓冲区大小>:预设置为8196,刚好等于ring buffer的大小; +-n:设置记录信息的层级。 +``` + +### 实例 + +``` +[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) +``` + +查看硬盘基础信息 + +```bash +dmesg | grep sda + +[ 2.442555] sd 0:0:0:0: [sda] 488281250 512-byte logical blocks: (250 GB/232 GiB) +[ 2.442590] sd 0:0:0:0: [sda] Write Protect is off +[ 2.442592] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00 +[ 2.442607] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA +[ 2.447533] sda: sda1 +[ 2.448503] sd 0:0:0:0: [sda] Attached SCSI disk +``` + +