1DMESG(1) User Commands DMESG(1)
2
3
4
6 dmesg - print or control the kernel ring buffer
7
9 dmesg [options]
10
11 dmesg --clear
12 dmesg --read-clear [options]
13 dmesg --console-level level
14 dmesg --console-on
15 dmesg --console-off
16
18 dmesg is used to examine or control the kernel ring buffer.
19
20 The default action is to display all messages from the kernel ring buf‐
21 fer.
22
24 The --clear, --read-clear, --console-on, --console-off, and --con‐
25 sole-level options are mutually exclusive.
26
27 -C, --clear
28 Clear the ring buffer.
29
30 -c, --read-clear
31 Clear the ring buffer after first printing its contents.
32
33 -D, --console-off
34 Disable the printing of messages to the console.
35
36 -d, --show-delta
37 Display the timestamp and the time delta spent between messages.
38 If used together with --notime then only the time delta without
39 the timestamp is printed.
40
41 -E, --console-on
42 Enable printing messages to the console.
43
44 -e, --reltime
45 Display the local time and the delta in human-readable format.
46 Be aware that conversion to the local time could be inaccurate
47 (see -T for more details).
48
49 -F, --file file
50 Read the syslog messages from the given file. Note that -F does
51 not support messages in kmsg format. The old syslog format is
52 supported only.
53
54 -f, --facility list
55 Restrict output to the given (comma-separated) list of facili‐
56 ties. For example:
57
58 dmesg --facility=daemon
59
60 will print messages from system daemons only. For all supported
61 facilities see the --help output.
62
63 -H, --human
64 Enable human-readable output. See also --color, --reltime and
65 --nopager.
66
67 -k, --kernel
68 Print kernel messages.
69
70 -L, --color[=when]
71 Colorize the output. The optional argument when can be auto,
72 never or always. If the when argument is omitted, it defaults
73 to auto. The colors can be disabled; for the current built-in
74 default see the --help output. See also the COLORS section
75 below.
76
77 -l, --level list
78 Restrict output to the given (comma-separated) list of levels.
79 For example:
80
81 dmesg --level=err,warn
82
83 will print error and warning messages only. For all supported
84 levels see the --help output.
85
86 -n, --console-level level
87 Set the level at which printing of messages is done to the con‐
88 sole. The level is a level number or abbreviation of the level
89 name. For all supported levels see the --help output.
90
91 For example, -n 1 or -n emerg prevents all messages, except
92 emergency (panic) messages, from appearing on the console. All
93 levels of messages are still written to /proc/kmsg, so sys‐
94 logd(8) can still be used to control exactly where kernel mes‐
95 sages appear. When the -n option is used, dmesg will not print
96 or clear the kernel ring buffer.
97
98 --noescape
99 The unprintable and potentially unsafe characters (e.g., broken
100 multi-byte sequences, terminal controlling chars, etc.) are
101 escaped in format \x<hex> for security reason by default. This
102 option disables this feature at all. It's usable for example for
103 debugging purpose together with --raw. Be careful and don't use
104 it by default.
105
106 -P, --nopager
107 Do not pipe output into a pager. A pager is enabled by default
108 for --human output.
109
110 -p, --force-prefix
111 Add facility, level or timestamp information to each line of a
112 multi-line message.
113
114 -r, --raw
115 Print the raw message buffer, i.e., do not strip the log-level
116 prefixes, but all unprintable characters are still escaped (see
117 also --noescape).
118
119 Note that the real raw format depends on the method how dmesg(1)
120 reads kernel messages. The /dev/kmsg device uses a different
121 format than syslog(2). For backward compatibility, dmesg(1)
122 returns data always in the syslog(2) format. It is possible to
123 read the real raw data from /dev/kmsg by, for example, the com‐
124 mand 'dd if=/dev/kmsg iflag=nonblock'.
125
126 -S, --syslog
127 Force dmesg to use the syslog(2) kernel interface to read kernel
128 messages. The default is to use /dev/kmsg rather than syslog(2)
129 since kernel 3.5.0.
130
131 -s, --buffer-size size
132 Use a buffer of size to query the kernel ring buffer. This is
133 16392 by default. (The default kernel syslog buffer size was
134 4096 at first, 8192 since 1.3.54, 16384 since 2.1.113.) If you
135 have set the kernel buffer to be larger than the default, then
136 this option can be used to view the entire buffer.
137
138 -T, --ctime
139 Print human-readable timestamps.
140
141 Be aware that the timestamp could be inaccurate! The time
142 source used for the logs is not updated after system SUS‐
143 PEND/RESUME. Timestamps are adjusted according to current delta
144 between boottime and monotonic clocks, this works only for mes‐
145 sages printed after last resume.
146
147 -t, --notime
148 Do not print kernel's timestamps.
149
150 --time-format format
151 Print timestamps using the given format, which can be ctime,
152 reltime, delta or iso. The first three formats are aliases of
153 the time-format-specific options. The iso format is a dmesg
154 implementation of the ISO-8601 timestamp format. The purpose of
155 this format is to make the comparing of timestamps between two
156 systems, and any other parsing, easy. The definition of the iso
157 timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone
158 offset from UTC>.
159
160 The iso format has the same issue as ctime: the time may be
161 inaccurate when a system is suspended and resumed.
162
163 -u, --userspace
164 Print userspace messages.
165
166 -w, --follow
167 Wait for new messages. This feature is supported only on sys‐
168 tems with a readable /dev/kmsg (since kernel 3.5.0).
169
170 -W, --follow-new
171 Wait and print only new messages.
172
173 -x, --decode
174 Decode facility and level (priority) numbers to human-readable
175 prefixes.
176
177 -V, --version
178 Display version information and exit.
179
180 -h, --help
181 Display help text and exit.
182
184 Implicit coloring can be disabled by an empty file /etc/terminal-col‐
185 ors.d/dmesg.disable. See terminal-colors.d(5) for more details about
186 colorization configuration.
187
188 The logical color names supported by dmesg are:
189
190 subsys The message sub-system prefix (e.g., "ACPI:").
191
192 time The message timestamp.
193
194 timebreak
195 The message timestamp in short ctime format in --reltime or
196 --human output.
197
198 alert The text of the message with the alert log priority.
199
200 crit The text of the message with the critical log priority.
201
202 err The text of the message with the error log priority.
203
204 warn The text of the message with the warning log priority.
205
206 segfault
207 The text of the message that inform about segmentation fault.
208
210 dmesg can fail reporting permission denied error. This is usually
211 caused by dmesg_restrict kernel setting, please see syslog(2) for more
212 details.
213
215 Karel Zak ⟨kzak@redhat.com⟩
216
217 dmesg was originally written by Theodore Ts'o ⟨tytso@athena.mit.edu⟩
218
220 terminal-colors.d(5), syslogd(8)
221
223 The dmesg command is part of the util-linux package and is available
224 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
225 linux/⟩.
226
227
228
229util-linux July 2012 DMESG(1)