linux下dmesg命令详解
2023-09-14 08:58:47 时间
前言:
有时候想查看一下开机启动信息,可以通过这个命令查询。
1,命令格式
功能说明:显示开机信息。
语 法:dmesg [-cn][-s <缓冲区大小>]
补充说明:kernel会将开机信息存储在ring buffer中。若是开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log目录中,名称为dmesg的文件里。
参 数:
-c 显示信息后,清除ring buffer中的内容。
-s<缓冲区大小> 预设置为8196,刚好等于ring buffer的大小。
-n 设置记录信息的层级。
2,使用示例
示例一 将开机信息发邮件
man dmesg 写道
The program helps users to print out their bootup messages. Instead of copying the messages by hand, the user need only:
dmesg > boot.messages
and mail the boot.messages file to whoever can debug their problem.
[root@new55 ~]# dmesg >boot.messages
[root@new55 ~]# ls -l boot.messages
-rw-r--r-- 1 root root 15838 12-09 12:55 boot.messages
[root@new55 ~]# mail -s "Boot Log of Linux Server" public@web3q.net <boot.messages
[root@new55 ~]#
示例二 浏览dmesg输出的信息
[root@new55 ~]# uname -a
Linux new55 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@new55 ~]# dmesg | less
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
BIOS-provided physical RAM map: ...
示例三 查看dmesg尾部的信息
[root@new55 ~]# dmesg | tail
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM ver 1.8
Bluetooth: HIDP (Human Interface Emulation) ver 1.1
eth0: no IPv6 routers present
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
NFSD: starting 90-second grace period
[root@new55 ~]#
示例四 查看串口的相关信息
[root@new55 ~]# dmesg | grep ttyS*
[ 1.360552] s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 16) is a S3C6400/10
[ 1.373853] s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 20) is a S3C6400/10
[ 1.388846] s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 24) is a S3C6400/10
[ 1.403845] s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 28) is a S3C6400/10
示例五 打印并清除内核环形缓冲区
[root@new55 ~]# dmesg -c
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010 ...
3,参考文件
a,http://www.shangxueba.com/jingyan/381649.html
b,http://codingstandards.iteye.com/blog/837486
有时候想查看一下开机启动信息,可以通过这个命令查询。
1,命令格式
功能说明:显示开机信息。
语 法:dmesg [-cn][-s <缓冲区大小>]
补充说明:kernel会将开机信息存储在ring buffer中。若是开机时来不及查看信息,可利用dmesg来查看。开机信息亦保存在/var/log目录中,名称为dmesg的文件里。
参 数:
-c 显示信息后,清除ring buffer中的内容。
-s<缓冲区大小> 预设置为8196,刚好等于ring buffer的大小。
-n 设置记录信息的层级。
2,使用示例
示例一 将开机信息发邮件
man dmesg 写道
The program helps users to print out their bootup messages. Instead of copying the messages by hand, the user need only:
dmesg > boot.messages
and mail the boot.messages file to whoever can debug their problem.
[root@new55 ~]# dmesg >boot.messages
[root@new55 ~]# ls -l boot.messages
-rw-r--r-- 1 root root 15838 12-09 12:55 boot.messages
[root@new55 ~]# mail -s "Boot Log of Linux Server" public@web3q.net <boot.messages
[root@new55 ~]#
示例二 浏览dmesg输出的信息
[root@new55 ~]# uname -a
Linux new55 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@new55 ~]# dmesg | less
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010
BIOS-provided physical RAM map: ...
示例三 查看dmesg尾部的信息
[root@new55 ~]# dmesg | tail
Bluetooth: L2CAP ver 2.8
Bluetooth: L2CAP socket layer initialized
Bluetooth: RFCOMM socket layer initialized
Bluetooth: RFCOMM TTY layer initialized
Bluetooth: RFCOMM ver 1.8
Bluetooth: HIDP (Human Interface Emulation) ver 1.1
eth0: no IPv6 routers present
Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
NFSD: starting 90-second grace period
[root@new55 ~]#
示例四 查看串口的相关信息
[root@new55 ~]# dmesg | grep ttyS*
[ 1.360552] s5pv210-uart.0: ttySAC0 at MMIO 0xe2900000 (irq = 16) is a S3C6400/10
[ 1.373853] s5pv210-uart.1: ttySAC1 at MMIO 0xe2900400 (irq = 20) is a S3C6400/10
[ 1.388846] s5pv210-uart.2: ttySAC2 at MMIO 0xe2900800 (irq = 24) is a S3C6400/10
[ 1.403845] s5pv210-uart.3: ttySAC3 at MMIO 0xe2900c00 (irq = 28) is a S3C6400/10
示例五 打印并清除内核环形缓冲区
[root@new55 ~]# dmesg -c
Linux version 2.6.18-194.el5 (mockbuild@x86-007.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-48)) #1 SMP Tue Mar 16 21:52:43 EDT 2010 ...
3,参考文件
a,http://www.shangxueba.com/jingyan/381649.html
b,http://codingstandards.iteye.com/blog/837486
相关文章
- Linux sftp命令详解程序员
- Linux文件的快速相加技术(linux文件相加)
- Linux下配置网关:让您轻松实现网络连接(linux下配置网关)
- 箱Linux系统 U盘写入:一次性解决工具箱(linux写入u盘工具)
- Linux系统必备命令:学会使用MV(linux系统mv命令)
- Linux迷你主机:一个新的小钻石(linux迷你主机)
- Linux系统下如何创建文件(linux系统下创建文件)
- Linux下浏览网页的方法(linux如何浏览网页)
- Linux包管理:从初学者到专家(linux包管理工具)
- 操作Linux 回退操作:挽回一切(linux回退)
- 以U盘装置了Linux:一个不同的安装之旅(把linux装进u盘)
- Linux编程实践:掌握编程精髓(实战linux编程精髓)
- Linux命令行下实现快速后退(linux后退命令)
- 深入了解Linux管理控制台:从基础命令到高级管理技巧(linux管理控制台)
- “Linux下捕获数据流量的必备技能:抓包命令”(linux下抓包命令)
- Linux系统进程数探究:如何优化与管理?(linux系统进程数)
- 如何在一台电脑上安装XP和Linux双系统?(xp与linux双系统)
- 25个字文章标题:掌握Linux重定向命令:从入门到精通(linux重定向命令)
- 如何在Linux中为用户设置组?(linux给用户设置组)
- Linux下IP地址快速配置指令(命令设置ip linux)
- 掌握Linux必备技能,25字带你执行目录Linux命令(执行目录linux命令)
- 「Linux计数:掌握常用统计命令,提高工作效率」(linux计数统计命令)
- Linux加route:实现数据有序转发(linux加route)