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       -n, --console-level level
96           Set the level at which printing of messages is done to the console.
97           The level is a level number or abbreviation of the level name. For
98           all supported levels see the --help output.
99
100           For example, -n 1 or -n emerg prevents all messages, except
101           emergency (panic) messages, from appearing on the console. All
102           levels of messages are still written to /proc/kmsg, so syslogd(8)
103           can still be used to control exactly where kernel messages appear.
104           When the -n option is used, dmesg will not print or clear the
105           kernel ring buffer.
106
107       --noescape
108           The unprintable and potentially unsafe characters (e.g., broken
109           multi-byte sequences, terminal controlling chars, etc.) are escaped
110           in format \x<hex> for security reason by default. This option
111           disables this feature at all. It’s usable for example for debugging
112           purpose together with --raw. Be careful and don’t use it by
113           default.
114
115       -P, --nopager
116           Do not pipe output into a pager. A pager is enabled by default for
117           --human output.
118
119       -p, --force-prefix
120           Add facility, level or timestamp information to each line of a
121           multi-line message.
122
123       -r, --raw
124           Print the raw message buffer, i.e., do not strip the log-level
125           prefixes, but all unprintable characters are still escaped (see
126           also --noescape).
127
128           Note that the real raw format depends on the method how dmesg reads
129           kernel messages. The /dev/kmsg device uses a different format than
130           syslog(2). For backward compatibility, dmesg returns data always in
131           the syslog(2) format. It is possible to read the real raw data from
132           /dev/kmsg by, for example, the command 'dd if=/dev/kmsg
133           iflag=nonblock'.
134
135       -S, --syslog
136           Force dmesg to use the syslog(2) kernel interface to read kernel
137           messages. The default is to use /dev/kmsg rather than syslog(2)
138           since kernel 3.5.0.
139
140       -s, --buffer-size size
141           Use a buffer of size to query the kernel ring buffer. This is 16392
142           by default. (The default kernel syslog buffer size was 4096 at
143           first, 8192 since 1.3.54, 16384 since 2.1.113.) If you have set the
144           kernel buffer to be larger than the default, then this option can
145           be used to view the entire buffer.
146
147       -T, --ctime
148           Print human-readable timestamps.
149
150           Be aware that the timestamp could be inaccurate! The time source
151           used for the logs is not updated after system SUSPEND/RESUME.
152           Timestamps are adjusted according to current delta between boottime
153           and monotonic clocks, this works only for messages printed after
154           last resume.
155
156       --since time
157           Display record since the specified time. The time is possible to
158           specify in absolute way as well as by relative notation (e.g. '1
159           hour ago'). Be aware that the timestamp could be inaccurate and see
160           --ctime for more details.
161
162       --until time
163           Display record until the specified time. The time is possible to
164           specify in absolute way as well as by relative notation (e.g. '1
165           hour ago'). Be aware that the timestamp could be inaccurate and see
166           --ctime for more details.
167
168       -t, --notime
169           Do not print kernel’s timestamps.
170
171       --time-format format
172           Print timestamps using the given format, which can be ctime,
173           reltime, delta or iso. The first three formats are aliases of the
174           time-format-specific options. The iso format is a dmesg
175           implementation of the ISO-8601 timestamp format. The purpose of
176           this format is to make the comparing of timestamps between two
177           systems, and any other parsing, easy. The definition of the iso
178           timestamp is: YYYY-MM-DD<T>HH:MM:SS,<microseconds>←+><timezone
179           offset from UTC>.
180
181           The iso format has the same issue as ctime: the time may be
182           inaccurate when a system is suspended and resumed.
183
184       -u, --userspace
185           Print userspace messages.
186
187       -w, --follow
188           Wait for new messages. This feature is supported only on systems
189           with a readable /dev/kmsg (since kernel 3.5.0).
190
191       -W, --follow-new
192           Wait and print only new messages.
193
194       -x, --decode
195           Decode facility and level (priority) numbers to human-readable
196           prefixes.
197
198       -h, --help
199           Display help text and exit.
200
201       -V, --version
202           Print version and exit.
203

COLORS

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

EXIT STATUS

248       dmesg can fail reporting permission denied error. This is usually
249       caused by dmesg_restrict kernel setting, please see syslog(2) for more
250       details.
251

AUTHORS

253       Karel Zak <kzak@redhat.com>
254
255       dmesg was originally written by Theodore Ts’o <tytso@athena.mit.edu>.
256

SEE ALSO

258       terminal-colors.d(5), syslogd(8)
259

REPORTING BUGS

261       For bug reports, use the issue tracker at
262       https://github.com/util-linux/util-linux/issues.
263

AVAILABILITY

265       The dmesg command is part of the util-linux package which can be
266       downloaded from Linux Kernel Archive
267       <https://www.kernel.org/pub/linux/utils/util-linux/>.
268
269
270
271util-linux 2.38.1                 2022-05-11                          DMESG(1)
Impressum