dmesg

打印内核(和驱动程序)消息,显示开机信息.

语法

  dmesg [ -c ] [ -n level ] [ -s bufsize ]

dmesg程序允许您从ring buffe打印系统消息(主要是启动时加载的内核和驱动程序),也可用于配置内核ring buffe

选项
-c 打印后清除ring buffe内容

-s bufsize 设置缓冲区大小,默认情况下为16392. (默认内核syslog缓冲区
大小最初为4096,自2.1.54以来为8192,自2.1.113以来为16384)

-n level 设置将消息记录到控制台的级别.
使用这两个选项时,只有命令行上的最后一个选项才会生效。
由于它是一个环形缓冲区,它将在缓冲区已满时自动循环输出旧信息

例子

将所有开机启动消息打印到文件:

$ sudo dmesg > messages.txt

打印最近的消息:

$ sudo dmesg | tail -f

dmesg 命令实例:

linux命令:dmesg -T -T dmesg dmesg -Trootopen.com
linux命令:dmesg -T -T dmesg dmesg -Trootopen.com
2019-02-12 21:20:14

linux命令:dmesg -wx -wx dmesg dmesg -wxrootopen.com
linux命令:dmesg -wx -wx dmesg dmesg -wxrootopen.com
2018-11-17 12:52:32

linux命令:dmesg | grep -i usb usb -i grep | dmesg dmesg | grep -i usbrootopen.com
linux命令:dmesg | grep -i usb usb -i grep | dmesg dmesg | grep -i usbrootopen.com
2018-08-11 22:33:24

linux命令:dmesg | grep cpu cpu grep | dmesg dmesg | grep cpurootopen.com
linux命令:dmesg | grep cpu cpu grep | dmesg dmesg | grep cpurootopen.com
2017-12-26 22:18:48

linux命令:dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g' \2|g' - +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m 's|\(^.*'`date -e -T|sed dmesg dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'rootopen.com
linux命令:dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g' \2|g' - +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m 's|\(^.*'`date -e -T|sed dmesg dmesg -T|sed -e 's|\(^.*'`date +%Y`']\)\(.*\)|\x1b[0;34m\1\x1b[0m - \2|g'rootopen.com
2018-01-16 05:31:48

linux命令:dmesg | grep -i sata | grep 'link up' up' 'link grep | sata -i grep | dmesg dmesg | grep -i sata | grep 'link up'rootopen.com
linux命令:dmesg | grep -i sata | grep 'link up' up' 'link grep | sata -i grep | dmesg dmesg | grep -i sata | grep 'link up'rootopen.com
2018-06-09 02:51:48

linux命令:dmesg -xT -l err,crit,emerg err,crit,emerg -l -xT dmesg dmesg -xT -l err,crit,emergrootopen.com
linux命令:dmesg -xT -l err,crit,emerg err,crit,emerg -l -xT dmesg dmesg -xT -l err,crit,emergrootopen.com
2018-05-20 02:48:48

linux命令:dmesg | grep -Po 'csum failed ino\S* \d+' | sort | uniq | xargs -n 3 find / -inum 2> /dev/null /dev/null 2> -inum / find 3 -n xargs | uniq | sort | \d+' ino\S* failed 'csum -Po grep | dmesg dmesg | grep -Po 'csum failed ino\S* \d+' | sort | uniq | xargs -n 3 find / -inum 2> /dev/nullrootopen.com
linux命令:dmesg | grep -Po 'csum failed ino\S* \d+' | sort | uniq | xargs -n 3 find / -inum 2> /dev/null /dev/null 2> -inum / find 3 -n xargs | uniq | sort | \d+' ino\S* failed 'csum -Po grep | dmesg dmesg | grep -Po 'csum failed ino\S* \d+' | sort | uniq | xargs -n 3 find / -inum 2> /dev/nullrootopen.com
2018-03-18 23:13:48

linux命令:dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/null /dev/null 2> -inum / find 1 -n xargs | -u sort | $4}' '{print awk | \d+' ino\S* failed 'csum -Po grep | dmesg dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/nullrootopen.com
linux命令:dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/null /dev/null 2> -inum / find 1 -n xargs | -u sort | $4}' '{print awk | \d+' ino\S* failed 'csum -Po grep | dmesg dmesg | grep -Po 'csum failed ino\S* \d+' | awk '{print $4}' | sort -u | xargs -n 1 find / -inum 2> /dev/nullrootopen.com
2018-05-22 00:27:48

linux命令:dmesg dmesg dmesgrootopen.com
linux命令:dmesg dmesg dmesgrootopen.com
2018-03-22 15:19:48

linux命令:dmesg -L=always | less -r -r less | -L=always dmesg dmesg -L=always | less -rrootopen.com
linux命令:dmesg -L=always | less -r -r less | -L=always dmesg dmesg -L=always | less -rrootopen.com
2018-05-17 11:13:48

Linux的Bash命令行(A-Z排序)