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.
144
145 -t, --notime
146 Do not print kernel's timestamps.
147
148 --time-format format
149 Print timestamps using the given format, which can be ctime,
150 reltime, delta or iso. The first three formats are aliases of
151 the time-format-specific options. The iso format is a dmesg
152 implementation of the ISO-8601 timestamp format. The purpose of
153 this format is to make the comparing of timestamps between two
154 systems, and any other parsing, easy. The definition of the iso
155 timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone
156 offset from UTC>.
157
158 The iso format has the same issue as ctime: the time may be
159 inaccurate when a system is suspended and resumed.
160
161 -u, --userspace
162 Print userspace messages.
163
164 -w, --follow
165 Wait for new messages. This feature is supported only on sys‐
166 tems with a readable /dev/kmsg (since kernel 3.5.0).
167
168 -x, --decode
169 Decode facility and level (priority) numbers to human-readable
170 prefixes.
171
172 -V, --version
173 Display version information and exit.
174
175 -h, --help
176 Display help text and exit.
177
179 Implicit coloring can be disabled by an empty file /etc/terminal-col‐
180 ors.d/dmesg.disable. See terminal-colors.d(5) for more details about
181 colorization configuration.
182
183 The logical color names supported by dmesg are:
184
185 subsys The message sub-system prefix (e.g., "ACPI:").
186
187 time The message timestamp.
188
189 timebreak
190 The message timestamp in short ctime format in --reltime or
191 --human output.
192
193 alert The text of the message with the alert log priority.
194
195 crit The text of the message with the critical log priority.
196
197 err The text of the message with the error log priority.
198
199 warn The text of the message with the warning log priority.
200
201 segfault
202 The text of the message that inform about segmentation fault.
203
205 dmesg can fail reporting permission denied error. This is usually
206 caused by dmesg_restrict kernel setting, please see syslog(2) for more
207 details.
208
210 terminal-colors.d(5), syslogd(8)
211
213 Karel Zak ⟨kzak@redhat.com⟩
214
215 dmesg was originally written by Theodore Ts'o ⟨tytso@athena.mit.edu⟩
216
218 The dmesg command is part of the util-linux package and is available
219 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
220 linux/⟩.
221
222
223
224util-linux July 2012 DMESG(1)