1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\" May be distributed under the GNU General Public License
3 .TH DMESG "1" "July 2012" "util-linux" "User Commands"
5 dmesg \- print or control the kernel ring buffer
12 .BR "dmesg \-\-read\-clear " [options]
14 .BI "dmesg \-\-console\-level " level
16 .B dmesg \-\-console\-on
18 .B dmesg \-\-console\-off
21 is used to examine or control the kernel ring buffer.
23 The default action is to display all messages from the kernel ring buffer.
29 .BR \-\-console\-off ,
32 options are mutually exclusive.
34 .IP "\fB\-C\fR, \fB\-\-clear\fR"
35 Clear the ring buffer.
36 .IP "\fB\-c\fR, \fB\-\-read\-clear\fR"
37 Clear the ring buffer after first printing its contents.
38 .IP "\fB\-D\fR, \fB\-\-console\-off\fR"
39 Disable the printing of messages to the console.
40 .IP "\fB\-d\fR, \fB\-\-show\-delta\fR"
41 Display the timestamp and the time delta spent between messages. If used
44 then only the time delta without the timestamp is printed.
45 .IP "\fB\-E\fR, \fB\-\-console\-on\fR"
46 Enable printing messages to the console.
47 .IP "\fB\-e\fR, \fB\-\-reltime\fR"
48 Display the local time and the delta in human-readable format. Be aware that
49 conversion to the local time could be inaccurate (see \fB\-T\fR for more
51 .IP "\fB\-F\fR, \fB\-\-file \fIfile\fR"
52 Read the syslog messages from the given
54 Note that \fB\-F\fR does not support messages in kmsg format. The old syslog format is supported only.
55 .IP "\fB\-f\fR, \fB\-\-facility \fIlist\fR"
56 Restrict output to the given (comma-separated)
58 of facilities. For example:
61 .B dmesg \-\-facility=daemon
64 will print messages from system daemons only. For all supported facilities
68 .IP "\fB\-H\fR, \fB\-\-human\fR"
69 Enable human-readable output. See also \fB\-\-color\fR, \fB\-\-reltime\fR
70 and \fB\-\-nopager\fR.
71 .IP "\fB\-k\fR, \fB\-\-kernel\fR"
72 Print kernel messages.
73 .IP "\fB\-L\fR, \fB\-\-color\fR[=\fIwhen\fR]"
74 Colorize the output. The optional argument \fIwhen\fP
75 can be \fBauto\fR, \fBnever\fR or \fBalways\fR. If the \fIwhen\fR argument is omitted,
76 it defaults to \fBauto\fR. The colors can be disabled; for the current built-in default
77 see the \fB\-\-help\fR output. See also the \fBCOLORS\fR section below.
78 .IP "\fB\-l\fR, \fB\-\-level \fIlist\fR"
79 Restrict output to the given (comma-separated)
81 of levels. For example:
84 .B dmesg \-\-level=err,warn
87 will print error and warning messages only. For all supported levels see the
90 .IP "\fB\-n\fR, \fB\-\-console\-level \fIlevel\fR
93 at which printing of messages is done to the console. The
95 is a level number or abbreviation of the level name. For all supported
104 prevents all messages, except emergency (panic) messages, from appearing on
105 the console. All levels of messages are still written to
109 can still be used to control exactly where kernel messages appear. When the
115 print or clear the kernel ring buffer.
116 .IP "\fB\-P\fR, \fB\-\-nopager\fR"
117 Do not pipe output into a pager. A pager is enabled by default for \fB\-\-human\fR output.
118 .IP "\fB\-p\fR, \fB\-\-force\-prefix\fR"
119 Add facility, level or timestamp information to each line of a multi-line message.
120 .IP "\fB\-r\fR, \fB\-\-raw\fR"
121 Print the raw message buffer, i.e. do not strip the log-level prefixes.
123 Note that the real raw format depends on the method how
125 reads kernel messages. The /dev/kmsg device uses a different format than
127 For backward compatibility,
129 returns data always in the
131 format. It is possible to read the real raw data from /dev/kmsg by, for example,
132 the command 'dd if=/dev/kmsg iflag=nonblock'.
133 .IP "\fB\-S\fR, \fB\-\-syslog\fR"
134 Force \fBdmesg\fR to use the
136 kernel interface to read kernel messages. The default is to use /dev/kmsg rather
140 .IP "\fB\-s\fR, \fB\-\-buffer\-size \fIsize\fR
143 to query the kernel ring buffer. This is 16392 by default. (The default
144 kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since
145 2.1.113.) If you have set the kernel buffer to be larger than the default,
146 then this option can be used to view the entire buffer.
147 .IP "\fB\-T\fR, \fB\-\-ctime\fR"
148 Print human-readable timestamps.
150 .B Be aware that the timestamp could be inaccurate!
153 source used for the logs is
156 .BR SUSPEND / RESUME .
157 .IP "\fB\-t\fR, \fB\-\-notime\fR"
158 Do not print kernel's timestamps.
159 .IP "\fB\-\-time\-format\fR \fIformat\fR"
160 Print timestamps using the given \fIformat\fR, which can be
166 The first three formats are aliases of the time-format-specific options.
171 implementation of the ISO-8601 timestamp format. The purpose of this format is
172 to make the comparing of timestamps between two systems, and any other parsing,
173 easy. The definition of the \fBiso\fR timestamp is:
174 YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone offset from UTC>.
178 format has the same issue as
180 the time may be inaccurate when a system is suspended and resumed.
182 .BR \-u , " \-\-userspace"
183 Print userspace messages.
185 .BR \-w , " \-\-follow"
186 Wait for new messages. This feature is supported only on systems with
187 a readable /dev/kmsg (since kernel 3.5.0).
189 .BR \-x , " \-\-decode"
190 Decode facility and level (priority) numbers to human-readable prefixes.
192 .BR \-V , " \-\-version"
193 Display version information and exit.
195 .BR \-h , " \-\-help"
196 Display help text and exit.
198 Implicit coloring can be disabled by an empty file \fI/etc/terminal-colors.d/dmesg.disable\fR.
200 .BR terminal-colors.d (5)
201 for more details about colorization configuration.
203 The logical color names supported by
208 The message sub-system prefix (e.g. "ACPI:").
211 The message timestamp.
214 The message timestamp in short ctime format in \fB\-\-reltime\fR
215 or \fB\-\-human\fR output.
218 The text of the message with the alert log priority.
221 The text of the message with the critical log priority.
224 The text of the message with the error log priority.
227 The text of the message with the warning log priority.
230 The text of the message that inform about segmentation fault.
233 can fail reporting permission denied error. This is usually caused by
235 kernel setting, please see
239 .BR terminal-colors.d (5),
248 was originally written by
249 .MT tytso@athena.mit.edu
253 The dmesg command is part of the util-linux package and is available from
254 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/