1DMESG(1)                         User Commands                        DMESG(1)
2
3
4

NAME

6       dmesg - print or control the kernel ring buffer
7

SYNOPSIS

9       dmesg [options]
10
11       dmesg --clear
12
13       dmesg --read-clear [options]
14
15       dmesg --console-level level
16
17       dmesg --console-on
18
19       dmesg --console-off
20

DESCRIPTION

22       dmesg is used to examine or control the kernel ring buffer.
23
24       The default action is to display all messages from the kernel ring
25       buffer.
26

OPTIONS

28       The --clear, --read-clear, --console-on, --console-off, and
29       --console-level options are mutually exclusive.
30
31       -C, --clear
32           Clear the ring buffer.
33
34       -c, --read-clear
35           Clear the ring buffer after first printing its contents.
36
37       -D, --console-off
38           Disable the printing of messages to the console.
39
40       -d, --show-delta
41           Display the timestamp and the time delta spent between messages. If
42           used together with --notime then only the time delta without the
43           timestamp is printed.
44
45       -E, --console-on
46           Enable printing messages to the console.
47
48       -e, --reltime
49           Display the local time and the delta in human-readable format. Be
50           aware that conversion to the local time could be inaccurate (see -T
51           for more details).
52
53       -F, --file file
54           Read the syslog messages from the given file. Note that -F does not
55           support messages in kmsg format. The old syslog format is supported
56           only.
57
58       -f, --facility list
59           Restrict output to the given (comma-separated) list of facilities.
60           For example:
61
62           dmesg --facility=daemon
63
64           will print messages from system daemons only. For all supported
65           facilities see the --help output.
66
67       -H, --human
68           Enable human-readable output. See also --color, --reltime and
69           --nopager.
70
71       -J, --json
72           Use JSON output format. The time output format is in "sec.usec"
73           format only, log priority level is not decoded by default (use
74           --decode to split into facility and priority), the other options to
75           control the output format or time format are silently ignored.
76
77       -k, --kernel
78           Print kernel messages.
79
80       -L, --color[=when]
81           Colorize the output. The optional argument when can be auto, never
82           or always. If the when argument is omitted, it defaults to auto.
83           The colors can be disabled; for the current built-in default see
84           the --help output. See also the COLORS section below.
85
86       -l, --level list
87           Restrict output to the given (comma-separated) list of levels. For
88           example:
89
90           dmesg --level=err,warn
91
92           will print error and warning messages only. For all supported
93           levels see the --help output.
94
95           Appending a plus + to a level name also includes all higher levels.
96           For example:
97
98           dmesg --level=err+
99
100           will print levels err, crit, alert and emerg.
101
102           Prepending it will include all lower levels.
103
104       -n, --console-level level
105           Set the level at which printing of messages is done to the console.
106           The level is a level number or abbreviation of the level name. For
107           all supported levels see the --help output.
108
109           For example, -n 1 or -n emerg prevents all messages, except
110           emergency (panic) messages, from appearing on the console. All
111           levels of messages are still written to /proc/kmsg, so syslogd(8)
112           can still be used to control exactly where kernel messages appear.
113           When the -n option is used, dmesg will not print or clear the
114           kernel ring buffer.
115
116       --noescape
117           The unprintable and potentially unsafe characters (e.g., broken
118           multi-byte sequences, terminal controlling chars, etc.) are escaped
119           in format \x<hex> for security reason by default. This option
120           disables this feature at all. It’s usable for example for debugging
121           purpose together with --raw. Be careful and don’t use it by
122           default.
123
124       -P, --nopager
125           Do not pipe output into a pager. A pager is enabled by default for
126           --human output.
127
128       -p, --force-prefix
129           Add facility, level or timestamp information to each line of a
130           multi-line message.
131
132       -r, --raw
133           Print the raw message buffer, i.e., do not strip the log-level
134           prefixes, but all unprintable characters are still escaped (see
135           also --noescape).
136
137           Note that the real raw format depends on the method how dmesg reads
138           kernel messages. The /dev/kmsg device uses a different format than
139           syslog(2). For backward compatibility, dmesg returns data always in
140           the syslog(2) format. It is possible to read the real raw data from
141           /dev/kmsg by, for example, the command 'dd if=/dev/kmsg
142           iflag=nonblock'.
143
144       -S, --syslog
145           Force dmesg to use the syslog(2) kernel interface to read kernel
146           messages. The default is to use /dev/kmsg rather than syslog(2)
147           since kernel 3.5.0.
148
149       -s, --buffer-size size
150           Use a buffer of size to query the kernel ring buffer. This is 16392
151           by default. (The default kernel syslog buffer size was 4096 at
152           first, 8192 since 1.3.54, 16384 since 2.1.113.) If you have set the
153           kernel buffer to be larger than the default, then this option can
154           be used to view the entire buffer.
155
156       -T, --ctime
157           Print human-readable timestamps.
158
159           Be aware that the timestamp could be inaccurate! The time source
160           used for the logs is not updated after system SUSPEND/RESUME.
161           Timestamps are adjusted according to current delta between boottime
162           and monotonic clocks, this works only for messages printed after
163           last resume.
164
165       --since time
166           Display record since the specified time. Supported is the subsecond
167           granularity. The time is possible to specify in absolute way as
168           well as by relative notation (e.g. '1 hour ago'). Be aware that the
169           timestamp could be inaccurate and see --ctime for more details.
170
171       --until time
172           Display record until the specified time. Supported is the subsecond
173           granularity. The time is possible to specify in absolute way as
174           well as by relative notation (e.g. '1 hour ago'). Be aware that the
175           timestamp could be inaccurate and see --ctime for more details.
176
177       -t, --notime
178           Do not print kernel’s timestamps.
179
180       --time-format format
181           Print timestamps using the given format, which can be ctime,
182           reltime, delta or iso. The first three formats are aliases of the
183           time-format-specific options. The iso format is a dmesg
184           implementation of the ISO-8601 timestamp format. The purpose of
185           this format is to make the comparing of timestamps between two
186           systems, and any other parsing, easy. The definition of the iso
187           timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds>←+><timezone
188           offset from UTC>.
189
190           The iso format has the same issue as ctime: the time may be
191           inaccurate when a system is suspended and resumed.
192
193       -u, --userspace
194           Print userspace messages.
195
196       -w, --follow
197           Wait for new messages. This feature is supported only on systems
198           with a readable /dev/kmsg (since kernel 3.5.0).
199
200       -W, --follow-new
201           Wait and print only new messages.
202
203       -x, --decode
204           Decode facility and level (priority) numbers to human-readable
205           prefixes.
206
207       -h, --help
208           Display help text and exit.
209
210       -V, --version
211           Print version and exit.
212

COLORS

214       The output colorization is implemented by terminal-colors.d(5)
215       functionality. Implicit coloring can be disabled by an empty file
216
217          /etc/terminal-colors.d/dmesg.disable
218
219       for the dmesg command or for all tools by
220
221          /etc/terminal-colors.d/disable
222
223       The user-specific $XDG_CONFIG_HOME/terminal-colors.d or
224       $HOME/.config/terminal-colors.d overrides the global setting.
225
226       Note that the output colorization may be enabled by default, and in
227       this case terminal-colors.d directories do not have to exist yet.
228
229       The logical color names supported by dmesg are:
230
231       subsys
232           The message sub-system prefix (e.g., "ACPI:").
233
234       time
235           The message timestamp.
236
237       timebreak
238           The message timestamp in short ctime format in --reltime or --human
239           output.
240
241       alert
242           The text of the message with the alert log priority.
243
244       crit
245           The text of the message with the critical log priority.
246
247       err
248           The text of the message with the error log priority.
249
250       warn
251           The text of the message with the warning log priority.
252
253       segfault
254           The text of the message that inform about segmentation fault.
255

EXIT STATUS

257       dmesg can fail reporting permission denied error. This is usually
258       caused by dmesg_restrict kernel setting, please see syslog(2) for more
259       details.
260

AUTHORS

262       Karel Zak <kzak@redhat.com>
263
264       dmesg was originally written by Theodore Ts’o <tytso@athena.mit.edu>.
265

SEE ALSO

267       terminal-colors.d(5), syslogd(8)
268

REPORTING BUGS

270       For bug reports, use the issue tracker at
271       https://github.com/util-linux/util-linux/issues.
272

AVAILABILITY

274       The dmesg command is part of the util-linux package which can be
275       downloaded from Linux Kernel Archive
276       <https://www.kernel.org/pub/linux/utils/util-linux/>.
277
278
279
280util-linux 2.39.2                 2023-06-14                          DMESG(1)
Impressum