dprintf - Linux


dprintf is a command-line utility used for outputting debugging information in the Linux kernel. It’s typically employed by kernel developers to print diagnostic messages at various points during kernel execution.


dprintf [options] [prefix] <message>


  • -n: Suppress line termination (\n)
  • -d: Set debugging level (0-7)
  • -P: Prefix output with PID
  • -t: Prefix output with timestamp
  • -c: Print output to console only
  • -w: Print output to a file


Simple debugging message:

dprintf "Hello from dprintf!"

Debug message with prefix:

dprintf hello "Hello from dprintf with prefix!"

Debug message to a file:

dprintf -w /tmp/debug.log "Writing debug message to a file"

Common Issues

Permission denied: Ensure the user running dprintf has write permissions to the target file or console.

Messages not appearing: Verify that the correct debugging level is set and that the message is printed at the appropriate time.


dprintf can be used in conjunction with other kernel debugging tools, such as kdb and gdb. It is often employed in scripts or command chains to automate the collection of debugging information.

Related Commands

  • printk: Kernel print function used for general debugging messages.
  • kdb: Kernel debugger that allows interactive debugging sessions.

Kernel Printk Documentation