• dmesg命令


    列出加载到内核中的所有驱动

    [root@node01 ~]# dmesg | more
    [    0.000000] Initializing cgroup subsys cpuset
    [    0.000000] Initializing cgroup subsys cpu
    [    0.000000] Initializing cgroup subsys cpuacct
    。。。。。。。。。。。。。。。。。。。。。

    列出所有被检测到的硬件

    [root@node01 ~]#  dmesg | grep sda
    [    1.070628] sd 0:0:0:0: [sda] 41943040 512-byte logical blocks: (21.4 GB/20.0 GiB)
    [    1.070670] sd 0:0:0:0: [sda] Write Protect is off
    [    1.070673] sd 0:0:0:0: [sda] Mode Sense: 61 00 00 00
    [    1.070716] sd 0:0:0:0: [sda] Cache data unavailable
    [    1.070719] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [    1.083734]  sda: sda1 sda2
    [    1.084105] sd 0:0:0:0: [sda] Attached SCSI disk
    [   29.714922] XFS (sda1): Mounting V5 Filesystem
    [   46.608484] XFS (sda1): Ending clean mount

    只输出dmesg命令的前20行日志

    [root@node01 ~]# dmesg | head -20
    [    0.000000] Initializing cgroup subsys cpuset
    [    0.000000] Initializing cgroup subsys cpu
    [    0.000000] Initializing cgroup subsys cpuacct
    [    0.000000] Linux version 3.10.0-693.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017
    [    0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-693.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet LANG=zh_CN.UTF-8
    [    0.000000] Disabled fast string operations
    [    0.000000] e820: BIOS-provided physical RAM map:
    [    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009ebff] usable
    [    0.000000] BIOS-e820: [mem 0x000000000009ec00-0x000000000009ffff] reserved
    [    0.000000] BIOS-e820: [mem 0x00000000000dc000-0x00000000000fffff] reserved
    [    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000001fedffff] usable
    [    0.000000] BIOS-e820: [mem 0x000000001fee0000-0x000000001fefefff] ACPI data
    [    0.000000] BIOS-e820: [mem 0x000000001feff000-0x000000001fefffff] ACPI NVS
    [    0.000000] BIOS-e820: [mem 0x000000001ff00000-0x000000001fffffff] usable
    [    0.000000] BIOS-e820: [mem 0x00000000f0000000-0x00000000f7ffffff] reserved
    [    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
    [    0.000000] BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
    [    0.000000] BIOS-e820: [mem 0x00000000fffe0000-0x00000000ffffffff] reserved
    [    0.000000] NX (Execute Disable) protection: active
    [    0.000000] SMBIOS 2.7 present.

    搜索包含特定字符串的被检测到的硬件

    dmesg | grep -i usb
    dmesg | grep -i dma
    dmesg | grep -i tty
    dmesg | grep -i memory

    清空dmesg缓冲区日志

    [root@node01 ~]# dmesg -c

    实时监控dmesg日志输出

    [root@node01 ~]# tail -f /var/log/dmesg
    [   26.476228] floppy0: no floppy controllers found
    [   26.476292] work still pending
    [   26.917993] ppdev: user-space parallel port driver
    [   27.688404] AES CTR mode by8 optimization enabled
    [   27.690744] alg: No test for __gcm-aes-aesni (__driver-gcm-aes-aesni)
    [   27.876144] alg: No test for crc32 (crc32-pclmul)
    [   27.922238] Adding 1023996k swap on /dev/mapper/centos-swap.  Priority:-1 extents:1 across:1023996k FS
    [   29.714922] XFS (sda1): Mounting V5 Filesystem
    [   46.608484] XFS (sda1): Ending clean mount
    [   47.241588] type=1305 audit(1580699963.196:3): audit_pid=636 old=0 auid=4294967295 ses=4294967295 res=1
  • 相关阅读:
    最短路变形题目 HDU多校7
    交换一个数字的任意两个位置,指定K次的最值
    七彩线段
    带限制的广搜 codeforces
    在一个矩阵内求一个最长上升子序列
    函数,以及三元运算符
    文件操作
    基础数据类型补充以及python编码
    深浅copy,is和==区别,集合,列表的操作
    字典和枚举
  • 原文地址:https://www.cnblogs.com/liujunjun/p/12264613.html
Copyright © 2020-2023  润新知