dmesg - Linux


The dmesg (display message) command in Linux is used to display the kernel ring buffer messages. It is commonly utilized for diagnosing hardware and driver issues related to the kernel. This command is especially helpful in troubleshooting system crashes, driver-related issues, and hardware malfunctions during the boot process.


The basic syntax of the dmesg command is:

dmesg [options]


  • -C, --clear: Clears the ring buffer after displaying its contents.
  • -D, --console-off: Disable printing messages to the console.
  • -E, --console-on: Enable printing messages to the console.
  • -F, --file <file>: Use the file instead of the ring buffer.
  • -H, --human: Make the output more readable by human beings.
  • -L, --color[=when]: Colorize the output; when can be auto, always, or never.
  • -d, --show-delta: Display time deltas between printed messages.
  • -f, --facility <list>: Only display messages from the specified facilities.
  • -l, --level <list>: Restrict output to defined levels (e.g., err, warn, info).
  • -n, --console-level <level>: Set the level at which logging of messages is done to the console.
  • -P, --nopager: Do not pipe output into a pager.
  • -r, --raw: Display the buffer in raw format.
  • -S, --syslog: Include messages from syslog.
  • -T, --ctime: Print human-readable timestamps.
  • -u, --userspace: Display only user-space messages.
  • -w, --follow: Continuously display new messages (similar to tail -f).


  1. Basic Output: Display the contents of the ring buffer.
  2. Human-Readable Format: Make the output easier to read for humans.
    dmesg -H
  3. Filter by Severity Level: Display only error messages.
    dmesg --level=err
  4. Follow New Messages: Continuously print new messages as they come in.
    dmesg -w
  5. Display Messages with Timestamps: Show messages with human-readable timestamps.
    dmesg -T

Common Issues

  • Buffer Size: The ring buffer has a limited size; old messages may be overwritten by new ones. Utilizing -w can help capture messages in real-time.
  • Permission Denied: Running dmesg may require elevated privileges (root access) to view all messages, depending on system security settings.


dmesg can be combined effectively with tools like grep to filter output based on specific patterns or keywords. For example, to find out information about USB devices:

dmesg | grep -i usb

This can be extended in scripts to automate troubleshooting processes or in real-time system monitoring setups.

  • logger: Tool to add messages to the system log.
  • syslogd: System logging daemon.
  • tail: View the end of a file (commonly used with -f for logs).

For further information, refer to the official dmesg documentation available in the man pages (man dmesg) or the Linux kernel documentation online.