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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • 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. fastmod: A fast partial replacement for the codemod tool, replace and replace all in the whole codebase
  2. beep: command not found
  3. caja: command not found
  4. upower: command not found
  5. CentOS / RHEL 5 : How to rebuild Initial Ramdisk Image
  6. what does .tar file mean
  7. Basic vi commands (cheat sheet)
  8. jps Command Examples
  9. dwebp: dwebp decompresses WebP files into PNG, PAM, PPM or PGM images
  10. groupadd: command not found

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright