table of contents
DMESG(1) | User Commands | DMESG(1) |
NAME¶
dmesg - print or control the kernel ring buffer
SYNOPSIS¶
dmesg [options]
dmesg --clear
dmesg --read-clear [options]
dmesg --console-level level
dmesg --console-on
dmesg --console-off
DESCRIPTION¶
dmesg is used to examine or control the kernel ring buffer.
The default action is to display all messages from the kernel ring buffer.
OPTIONS¶
The --clear, --read-clear, --console-on, --console-off, and --console-level options are mutually exclusive.
-C, --clear
-c, --read-clear
-D, --console-off
-d, --show-delta
-E, --console-on
-e, --reltime
-F, --file file
-f, --facility list
dmesg --facility=daemon
will print messages from system daemons only. For all supported facilities see the --help output.
-H, --human
-J, --json
-K, --kmsg-file file
-k, --kernel
-L, --color[=when]
-l, --level list
dmesg --level=err,warn
will print error and warning messages only. For all supported levels see the --help output.
Appending a plus + to a level name also includes all higher levels. For example:
dmesg --level=err+
will print levels err, crit, alert and emerg.
Prepending it will include all lower levels.
-n, --console-level level
For example, -n 1 or -n emerg prevents all messages, except emergency (panic) messages, from appearing on the console. All levels of messages are still written to /proc/kmsg, so syslogd(8) can still be used to control exactly where kernel messages appear. When the -n option is used, dmesg will not print or clear the kernel ring buffer.
--noescape
-P, --nopager
-p, --force-prefix
-r, --raw
Note that the real raw format depends on the method how dmesg reads kernel messages. The /dev/kmsg device uses a different format than syslog(2). For backward compatibility, dmesg returns data always in the syslog(2) format. It is possible to read the real raw data from /dev/kmsg by, for example, the command 'dd if=/dev/kmsg iflag=nonblock'.
-S, --syslog
-s, --buffer-size size
-T, --ctime
Be aware that the timestamp could be inaccurate! The time source used for the logs is not updated after system SUSPEND/RESUME. Timestamps are adjusted according to current delta between boottime and monotonic clocks, this works only for messages printed after last resume.
--since time
--until time
-t, --notime
--time-format format
The iso format has the same issue as ctime: the time may be inaccurate when a system is suspended and resumed.
--time-format may be used multiple times with different values for format to output each specified format.
The delta always follows ctime or raw if specified together.
-u, --userspace
-w, --follow
-W, --follow-new
-x, --decode
-h, --help
-V, --version
COLORS¶
The output colorization is implemented by terminal-colors.d(5) functionality. Implicit coloring can be disabled by an empty file
/etc/terminal-colors.d/dmesg.disable
for the dmesg command or for all tools by
/etc/terminal-colors.d/disable
The user-specific $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d overrides the global setting.
Note that the output colorization may be enabled by default, and in this case terminal-colors.d directories do not have to exist yet.
The logical color names supported by dmesg are:
subsys
time
timebreak
alert
crit
err
warn
segfault
EXIT STATUS¶
dmesg can fail reporting permission denied error. This is usually caused by dmesg_restrict kernel setting, please see syslog(2) for more details.
AUTHORS¶
Karel Zak <kzak@redhat.com>
dmesg was originally written by Theodore Ts’o <tytso@athena.mit.edu>.
SEE ALSO¶
REPORTING BUGS¶
For bug reports, use the issue tracker at <https://github.com/util-linux/util-linux/issues>.
AVAILABILITY¶
The dmesg command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.
2024-05-28 | util-linux 2.40.2 |