• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

dmesg Command Examples in Linux

by admin

The dmesg command is a great command for troubleshooting hardware issues. When a system initially boots, the kernel will identify the various hardware devices available to that system. As the kernel identifies these devices, the information is written to the kernel’s ring buffer. This ring buffer is essentially an internal log for the kernel. The dmesg command can be used to print this ring buffer.

The following is an example output from the dmesg command:

# dmesg
[    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-229.1.2.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Fri Mar 27 03:04:26 UTC 2015
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.10.0-229.1.2.el7.x86_64 root=/dev/mapper/md0-root ro rd.lvm.lv=md0/swap crashkernel=auto rd.md.uuid=bec13d99:42674929:76663813:f748e7cb rd.lvm.lv=md0/root rd.md.uuid=7adf0323:b0962394:387e6cd0:b2914469 rhgb quiet LANG=en_US.UTF-8 systemd.debug
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009

You can use the option -T to view the messages along with the timestamp.

# dmesg -T | less

dmesg Command Examples

1. To print or control the kernel ring buffer:

# dmesg

2. To clear the kernel ring buffer after printing:

# dmesg -c

3. To print the raw message buffer:

# dmesg -r

4. To specify the ring buffer size:

# dmesg -s 1024

5. To set the level of logging:

# dmesg -n level
# dmesg -n 1      ## prevent all messages

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS / RHEL : Resize (reduce) non-root EXT3/4 filesystem on non-LVM device (hard disk partition)
  2. What is HBA Queue Depth and How to Check the Current Queue Depth Value and how to Change it
  3. All Linux Compress/Decompress Commands
  4. lvmconf Command Examples in Linux
  5. How to configure the logging of failed login attempts for vsftpd
  6. Understanding System Security Services Daemon (SSSD)
  7. How to modify snmp service to listen to an alternative port in CentOS/RHEL
  8. dig Command Examples in Linux
  9. How to Read Audit Log in Linux
  10. Common NFS mount options in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • JavaFX ComboBox: Set a value to the combo box
  • Nginx load balancing
  • nginx 504 gateway time-out
  • Images preview with ngx_http_image_filter_module

© 2022 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright