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 messages from the given
54 .IP "\fB\-f\fR, \fB\-\-facility \fIlist\fR"
55 Restrict output to the given (comma-separated)
57 of facilities. For example:
60 .B dmesg \-\-facility=daemon
63 will print messages from system daemons only. For all supported facilities
67 .IP "\fB\-H\fR, \fB\-\-human\fR"
68 Enable human-readable output. See also \fB\-\-color\fR, \fB\-\-reltime\fR
69 and \fB\-\-nopager\fR.
70 .IP "\fB\-k\fR, \fB\-\-kernel\fR"
71 Print kernel messages.
72 .IP "\fB\-L\fR, \fB\-\-color\fR[=\fIwhen\fR]"
73 Colorize the output. The optional argument \fIwhen\fP
74 can be \fBauto\fR, \fBnever\fR or \fBalways\fR. If the \fIwhen\fR argument is omitted,
75 it defaults to \fBauto\fR. The colors can be disabled; for the current built-in default
76 see the \fB\-\-help\fR output. See also the \fBCOLORS\fR section below.
77 .IP "\fB\-l\fR, \fB\-\-level \fIlist\fR"
78 Restrict output to the given (comma-separated)
80 of levels. For example:
83 .B dmesg \-\-level=err,warn
86 will print error and warning messages only. For all supported levels see the
89 .IP "\fB\-n\fR, \fB\-\-console\-level \fIlevel\fR
92 at which printing of messages is done to the console. The
94 is a level number or abbreviation of the level name. For all supported
103 prevents all messages, except emergency (panic) messages, from appearing on
104 the console. All levels of messages are still written to
108 can still be used to control exactly where kernel messages appear. When the
114 print or clear the kernel ring buffer.
115 .IP "\fB\-P\fR, \fB\-\-nopager\fR"
116 Do not pipe output into a pager. A pager is enabled by default for \fB\-\-human\fR output.
117 .IP "\fB\-r\fR, \fB\-\-raw\fR"
118 Print the raw message buffer, i.e. do not strip the log-level prefixes.
120 Note that the real raw format depends on the method how
122 reads kernel messages. The /dev/kmsg device uses a different format than
124 For backward compatibility,
126 returns data always in the
128 format. It is possible to read the real raw data from /dev/kmsg by, for example,
129 the command 'dd if=/dev/kmsg iflag=nonblock'.
130 .IP "\fB\-S\fR, \fB\-\-syslog\fR"
131 Force \fBdmesg\fR to use the
133 kernel interface to read kernel messages. The default is to use /dev/kmsg rather
137 .IP "\fB\-s\fR, \fB\-\-buffer\-size \fIsize\fR
140 to query the kernel ring buffer. This is 16392 by default. (The default
141 kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since
142 2.1.113.) If you have set the kernel buffer to be larger than the default,
143 then this option can be used to view the entire buffer.
144 .IP "\fB\-T\fR, \fB\-\-ctime\fR"
145 Print human-readable timestamps.
147 .B Be aware that the timestamp could be inaccurate!
150 source used for the logs is
153 .BR SUSPEND / RESUME .
154 .IP "\fB\-t\fR, \fB\-\-notime\fR"
155 Do not print kernel's timestamps.
156 .IP "\fB\-\-time\-format\fR \fIformat\fR"
157 Print timestamps using the given \fIformat\fR, which can be
163 The first three formats are aliases of the time-format-specific options.
168 implementation of the ISO-8601 timestamp format. The purpose of this format is
169 to make the comparing of timestamps between two systems, and any other parsing,
170 easy. The definition of the \fBiso\fR timestamp is:
171 YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone offset from UTC>.
175 format has the same issue as
177 the time may be inaccurate when a system is suspended and resumed.
179 .BR \-u , " \-\-userspace"
180 Print userspace messages.
182 .BR \-w , " \-\-follow"
183 Wait for new messages. This feature is supported only on systems with
184 a readable /dev/kmsg (since kernel 3.5.0).
186 .BR \-x , " \-\-decode"
187 Decode facility and level (priority) numbers to human-readable prefixes.
189 .BR \-V , " \-\-version"
190 Display version information and exit.
192 .BR \-h , " \-\-help"
193 Display help text and exit.
195 Implicit coloring can be disabled by an empty file \fI/etc/terminal-colors.d/dmesg.disable\fR.
197 .BR terminal-colors.d (5)
198 for more details about colorization configuration.
200 The logical color names supported by
205 The message sub-system prefix (e.g. "ACPI:").
208 The message timestamp.
211 The message timestamp in short ctime format in \fB\-\-reltime\fR
212 or \fB\-\-human\fR output.
215 The text of the message with the alert log priority.
218 The text of the message with the critical log priority.
221 The text of the message with the error log priority.
224 The text of the message with the warning log priority.
227 The text of the message that inform about segmentation fault.
230 .BR terminal-colors.d (5),
239 was originally written by
240 .MT tytso@athena.mit.edu
244 The dmesg command is part of the util-linux package and is available from
245 .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/