Linux命令——dmesg
Linux dmesg Command Tutorial for Beginners (5 Examples)
7 ‘dmesg’ Commands for Troubleshooting and Collecting Information of Linux Systems
前言
Linux启动是个复杂的流程,BIOS->MBR->boot loader。。。
boot loader阶段有Kernel以及initrd,Kernel通过initrd加载到bootable device的驱动后正式接管根目录文件系统,然后加载各种驱动,准备OS下程序运行环境等等。boot loader详细工作如下图。

Kernel做了这么多事情,有什么办法观察内核所作的工作吗? dmesg可以。
使用
无参数
无参数使用dmesg时,会把内核buffer ring中的所有日志全部显示出来,直接看比较麻烦。我在自己的环境上测试,有1700多条日志
[root@localhost etc]# dmesg | wc -l
通过日志等级缩小dmesg输出
这个是参考国外博客的,但是现在dmesg不允许这么用了
日志等级从低到高
info - 一些基本的信息说明
notice - 比 info 稍稍重要些
warn - 警示的信息,可能有问题,但是还不至于影响到某个 daemon 运行。基本上, info, notice, warn 这三个等级都是在通知一些基本信息,还不至于对系统运行造成影响
err - 一些重大的错误信息,例如配置档的某些配置值造成该服务服法启动, 通常通过 err 的错误告知
crit - 错误临界点
alert - 警告,问题很严重,必须立即采取行动
emerg - 系统已经几乎要死机的状态,大概只有硬件出问题,导致整个核心无法顺利运行,才会出现这样的情况
-c Clear the ring buffer contents after printing.
-r Print the raw message buffer, i.e., don’t strip the log level prefixes.
-s bufsize
Use a buffer of size bufsize to query the kernel ring buffer. This is 16392 by default. (The default kernel syslog buffer size was 4096 at first,
8192 since 1.3.54, 16384 since 2.1.113.) If you have set the kernel buffer to be larger than the default then this option can be used to view the
entire buffer.
-n level
Set the level at which logging of messages is done to the console. For example, -n 1 prevents all messages, except panic messages, from appearing on
the console. All levels of messages are still written to /proc/kmsg, so syslogd(8) can still be used to control exactly where kernel messages appear.
When the -n option is used, dmesg will not print or clear the kernel ring buffer.
When both options are used, only the last option on the command line will have an effect.
Linux命令——dmesg的更多相关文章
- linux命令dmesg查看进程被杀死原因
有一次一个python进程挂了,使用了下这个命令. 可以看到原因:虚拟机总共内存8082608KB,结果python项目就消耗掉了7341764KB,内存泄露,导致python进程被系统杀死 顺带介绍 ...
- Linux命令 dmesg:分析内核产生的信息
案例一 输出所有的内核开机时的信息 zh@zh:~$dmesg | more 案例二 查找开机的时候硬盘的相关信息
- 【linux】dmesg命令显示开机信息和设备加载情况
Linux命令dmesg用来显示开机信息,kernel会将开机信息存储在ring buffer中.您若是开机时来不及查看信息,可利用dmesg来查看.开机信息亦保存在/var/log目录中,名称为dm ...
- (转)Linux 系统设置 : dmesg 命令详解
原文:https://blog.csdn.net/yexiangCSDN/article/details/80683246 https://www.cnblogs.com/duanxz/p/34770 ...
- Linux下dmesg命令处理故障和收集系统信息的7种用法
目录: <syslog之一:Linux syslog日志系统详解> <syslog之二:syslog协议及rsyslog服务全解析> <syslog之三:建立Window ...
- Linux命令整理中...
Linux命令整理中... 最常用命令(我最近最常用的一般放在前面tipsbychsry) clear 清屏 date 显示日期 cal 显示日历 cal 2014 显示2014年的日历 shutdo ...
- LINUX命令总结 -------来自 水滴娃娃 的CSDN
LINUX命令总结 标签: LINUX命令总结 2014-01-27 15:54 41039人阅读 评论(1) 收藏 举报 分类: linux(1) 版权声明:本文为博主原创文章,未经博主允许不得 ...
- [Android ] linux命令英文缩写的含义(方便记忆)
du -sh */ reference to : http://blog.chinaunix.net/uid-27164517-id-3299073.html linux常用命令的英文单词缩写 命令缩 ...
- 开发过程中常用的Linux命令
做Java开发好几年了,部署JavaWeb到服务器上,一般都选择Linux,Linux作为服务器真是不二之选,高性能,只要熟悉Linux,操作快捷,效率很高. 总结一下工作中常用的Linux命令备忘: ...
随机推荐
- 转 mysql 备份导致 waiting for global read lock
######转 https://blog.csdn.net/weixin_34038652/article/details/92129498 近业务高峰期间经常会有开发跳起来说应用连接数据库超时了! ...
- layui table.reload的bug
bug1: bug描述:当cols列在reload中有变化时,渲染后部分cols列自动隐藏(并未对这些列设置hide:true) bug版本:2.3.5版本有此bug,今日更新最新版本2.5.5 仍有 ...
- windows10 卓越性能模式
打开cmd,输入 powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61 再到电池选项里,勾选卓越性能模式 若没出现卓越性能,创建 ...
- [LeetCode] 61. Rotate List 旋转链表
Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: I ...
- [LeetCode] 220. Contains Duplicate III 包含重复元素 III
Given an array of integers, find out whether there are two distinct indices i and j in the array suc ...
- RobotFramework与Jenkins集成后发送groovy报告(比别处多了用例作者信息)
https://www.cnblogs.com/gcgc/p/10037891.html 这篇文章中最终的发送报告是这个样子,每天大家看到这封邮件后也不知道是不是自己的用例错误了,导致大家不积极回复邮 ...
- PHP 23种设计模式
学习PHP,对设计模式永远是逃不掉的:今天把php23种设计模式及其demo好好整理如下: 记录PHP关于23种设计模式的简单Demo. Demo地址:https://segmentfault.com ...
- LeetCode 187. 重复的DNA序列(Repeated DNA Sequences)
187. 重复的DNA序列 187. Repeated DNA Sequences 题目描述 All DNA is composed of a series of nucleotides abbrev ...
- 使用TCP的协议有哪些?使用UDP的协议有哪些?
运行于TCP协议之上的协议: HTTP协议:超文本传输协议,用于普通浏览 HTTPS协议:安全超文本传输协议,身披SSL外衣的HTTP协议 FTP协议:文件传输协议,用于文件传输 POP3协议:邮局协 ...
- c++快速排序原理及优化
快速排序 快速排序的时间复杂度为O(logn) 注意:快速排序主要是标志数的选取,如果所选的数恰好为最小或者最大,则是最糟糕的情况,即一轮下来数据没有发生变化! 如何选取中间的标志数成为了算法的关键. ...