您的位置:首页 > 运维架构 > Linux

linux dmesg命令

2015-08-25 21:17 405 查看
这个忘记在哪看到的东西,所以整理一下吧。

首先这个命令的功能是显示开机的一些信息,

‘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一下吧
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Linux命令