When to use dmesg
Use dmesg to inspect the kernel's message buffer while investigating device, driver and storage events. Access may be restricted, and the buffer is not an unlimited history of everything that happened since installation.
Syntax
dmesg [PARAMETERS]Square brackets mark optional arguments; an ellipsis means repetition. Replace example file names, user names and server addresses with your own values.
Common options and arguments
Usage examples
View recent kernel messages
sudo dmesg | tail -n 50A short tail of kernel messages is displayed.
Select errors and warnings
sudo dmesg --level=err,warnOnly warning and error priority messages are requested.
Follow new events
sudo dmesg -wNew kernel messages are followed until you interrupt the viewer.
Notes and limitations
- Access is often controlled by the kernel.dmesg_restrict setting.
- The kernel ring buffer is not a complete long-term log. Messages may be suppressed.
Common questions and troubleshooting
Why does dmesg report an access error?
Kernel log visibility may be restricted by system policy. Use authorised access or the permitted journal interface rather than disabling protections.
Are dmesg timestamps always wall-clock time?
Not necessarily. Output can use time since boot and conversion modes have limitations. Correlate with boot time and journal timestamps carefully.
Further help
Options vary by version and distribution. Check the installed documentation with this command: man dmesg.