Linux – How to write to dmesg from command line

command linedmesgkernellinuxlogs

I'd like to write a statement to dmesg. How can I do this?

Best Answer

Write to /dev/kmsg (not /proc/kmsg as suggested by @Nils). See linux/kernel/printk/printk.c devkmsg_writev for the kernel-side implementation and systemd/src/journal/journald-kmsg.c server_forward_kmsg for an example of usage.