dmesg 命令

dmesg(英文全称:display message)命令用于显示开机信息。

开机信息亦保存在 /var/log 目录中,名称为 dmesg 的文件里。


一、语法

dmesg [选项]


二、选项

-C, --clear 清除内核环形缓冲区(ring butter)
-c, --read-clear 读取并清除所有消息
-D, --console-off 禁止向终端打印消息
-E, --console-on 启用向终端打印消息
-F, --file <文件> 用 文件 代替内核日志缓冲区
-f, --facility <列表> 将输出限制为定义的设施
-H, --human 易读格式输出
-k, --kernel 显示内核消息
-L, --color[=<when>] colorize messages (auto, always or never)
默认启用颜色
-l, --level <列表> 限制输出级别
-n, --console-level <级别> 设置打印到终端的消息级别
-P, --nopager 不将输出通过管道传递给分页程序
-p, --force-prefix force timestamp output on each line of multi-line messages
-r, --raw 打印原生消息缓冲区
--noescape don't escape unprintable character
-S, --syslog 强制使用 syslog(2) 而非 /dev/kmsg
-s, --buffer-size <大小> 查询内核环形缓冲区所用的缓冲区大小,预设置为 8196,刚好等于 ring buffer 的大小
-u, --userspace 显示用户空间消息
-w, --follow 等待新消息
-W, --follow-new wait and print only new messages
-x, --decode 将设施和级别解码为可读的字符串
-d, --show-delta 显示打印消息之间的时间差
-e, --reltime 以易读格式显示本地时间和时间差
-T, --ctime 显示易读的时间戳(可能不准确!)
-t, --notime 不显示任何消息的时间戳
--time-format <格式> 以指定格式显示时间戳:
[delta|reltime|ctime|notime|iso]
挂起/恢复会使 ctime 和 iso 时间戳不精确。
--since <time> display the lines since the specified time
--until <time> display the lines until the specified time

-h, --help 显示此帮助
-V, --version 显示版本

支持的日志设施:
kern - 内核消息
user - 随机的用户级消息
mail - 邮件系统
daemon - 系统守护进程
auth - 安全/认证消息
syslog - syslogd 内部生成的消息
lpr - 行打印机子系统
news - 网络新闻子系统

支持的日志级别(优先级):
emerg - 系统无法使用
alert - 操作必须立即执行
crit - 紧急条件
err - 错误条件
warn - 警告条件
notice - 正常但重要的条件
info - 信息
debug - 调试级别的消息


 

三、实例


1.显示开机信息

dmesg | less


2.指定级别

dmesg -l err,warn



3.指定类别

dmesg -f daemon

4.显示颜色

dmesg -L

5.显示时间

dmesg -T

6.查找特定内容

dmesg | grep -i memory

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值