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 alert 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 -P, --nopager
99 Do not pipe output into a pager. A pager is enabled by default
100 for --human output.
101
102 -p, --force-prefix
103 Add facility, level or timestamp information to each line of a
104 multi-line message.
105
106 -r, --raw
107 Print the raw message buffer, i.e. do not strip the log-level
108 prefixes.
109
110 Note that the real raw format depends on the method how dmesg(1)
111 reads kernel messages. The /dev/kmsg device uses a different
112 format than syslog(2). For backward compatibility, dmesg(1)
113 returns data always in the syslog(2) format. It is possible to
114 read the real raw data from /dev/kmsg by, for example, the com‐
115 mand 'dd if=/dev/kmsg iflag=nonblock'.
116
117 -S, --syslog
118 Force dmesg to use the syslog(2) kernel interface to read kernel
119 messages. The default is to use /dev/kmsg rather than syslog(2)
120 since kernel 3.5.0.
121
122 -s, --buffer-size size
123 Use a buffer of size to query the kernel ring buffer. This is
124 16392 by default. (The default kernel syslog buffer size was
125 4096 at first, 8192 since 1.3.54, 16384 since 2.1.113.) If you
126 have set the kernel buffer to be larger than the default, then
127 this option can be used to view the entire buffer.
128
129 -T, --ctime
130 Print human-readable timestamps.
131
132 Be aware that the timestamp could be inaccurate! The time
133 source used for the logs is not updated after system SUS‐
134 PEND/RESUME.
135
136 -t, --notime
137 Do not print kernel's timestamps.
138
139 --time-format format
140 Print timestamps using the given format, which can be ctime,
141 reltime, delta or iso. The first three formats are aliases of
142 the time-format-specific options. The iso format is a dmesg
143 implementation of the ISO-8601 timestamp format. The purpose of
144 this format is to make the comparing of timestamps between two
145 systems, and any other parsing, easy. The definition of the iso
146 timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone
147 offset from UTC>.
148
149 The iso format has the same issue as ctime: the time may be
150 inaccurate when a system is suspended and resumed.
151
152 -u, --userspace
153 Print userspace messages.
154
155 -w, --follow
156 Wait for new messages. This feature is supported only on sys‐
157 tems with a readable /dev/kmsg (since kernel 3.5.0).
158
159 -x, --decode
160 Decode facility and level (priority) numbers to human-readable
161 prefixes.
162
163 -V, --version
164 Display version information and exit.
165
166 -h, --help
167 Display help text and exit.
168
170 Implicit coloring can be disabled by an empty file /etc/terminal-col‐
171 ors.d/dmesg.disable. See terminal-colors.d(5) for more details about
172 colorization configuration.
173
174 The logical color names supported by dmesg are:
175
176 subsys The message sub-system prefix (e.g. "ACPI:").
177
178 time The message timestamp.
179
180 timebreak
181 The message timestamp in short ctime format in --reltime or
182 --human output.
183
184 alert The text of the message with the alert log priority.
185
186 crit The text of the message with the critical log priority.
187
188 err The text of the message with the error log priority.
189
190 warn The text of the message with the warning log priority.
191
192 segfault
193 The text of the message that inform about segmentation fault.
194
196 dmesg can fail reporting permission denied error. This is usually
197 caused by dmesg_restrict kernel setting, please see syslog(2) for more
198 details.
199
201 terminal-colors.d(5), syslogd(8)
202
204 Karel Zak ⟨kzak@redhat.com⟩
205
206 dmesg was originally written by Theodore Ts'o ⟨tytso@athena.mit.edu⟩
207
209 The dmesg command is part of the util-linux package and is available
210 from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
211 linux/⟩.
212
213
214
215util-linux July 2012 DMESG(1)