linux dmesg命令

这个忘记在哪看到的东西,所以整理一下吧。
首先这个命令的功能是显示开机的一些信息,
‘dmesg’命令显示linux内核的环形缓冲区信息,我们可以从中获得诸如系统架构、cpu、挂载的硬件,RAM等多个运行级别的大量的系统信息。当计算机启动时,系统内核(操作系统的核心部分)将会被加载到内存中。在加载的过程中会显示很多的信息,在这些信息中我们可以看到内核检测硬件设备。
可以通过查看这个信息来设备作诊断等等。
语法很简单
#dmesg [options...]
可以通过gudh@lxc-D3F2-CM:~$ dmesg | less 来查看开机的信息

[1992897.493681] Hello, world
[1993466.652501] lxcbr0: port 1(veth6OFC3J) entered disabled state
[1993466.652934] device veth6OFC3J left promiscuous mode
[1993466.652946] lxcbr0: port 1(veth6OFC3J) entered disabled state
[1993563.940780] usb 2-5: USB disconnect, device number 30
[1993668.874543] usb 2-5: new high-speed USB device number 31 using ehci-pci
[1993669.007520] usb 2-5: New USB device found, idVendor=18d1, idProduct=d002
[1993669.007528] usb 2-5: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[1993669.007532] usb 2-5: Product: Android
[1993669.007536] usb 2-5: Manufacturer: Android
[1993669.007539] usb 2-5: SerialNumber: 0123456789ABCDEF
[1993832.730937] usb 2-5: USB disconnect, device number 31
[1993887.468794] Goodbye
[1993890.641975] Hello, world
[1994023.751138] Goodbye

linux管道事很好用的东西,相信都体验过其好用的地方,在管道后面可以加grep找到自己有用的信息
同时还有其他的用法

-C, --clear
              Clear the ring buffer.

       -c, --read-clear
              Clear the ring buffer contents after printing.

       -D, --console-off
              Disable printing messages to the console.

       -d, --show-delta
              Display  the  timestamp  and time delta spent between messages. If used together with --notime then only the time delta without
              the timestamp is printed.

       -E, --console-on
              Enable printing messages to the console.

       -f, --facility list
              Restrict output to defined (comma separated) list of facilities. For example

                dmesg --facility=daemon

              will print messages from system daemons only. For all supported facilities see dmesg --help output.

       -h, --help
              Print a help text and exit.

通过使用这个gudh@lxc-D3F2-CM:~$ dmesg -c 可以将缓冲区的信息清空,其他的功能暂时未用,上面是man出来的用法,先mark一下吧

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值