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

COLORS

199       Implicit coloring can be disabled by an empty file
200       /etc/terminal-colors.d/dmesg.disable. See terminal-colors.d(5) for more
201       details about colorization configuration.
202
203       The logical color names supported by dmesg are:
204
205       subsys
206           The message sub-system prefix (e.g., "ACPI:").
207
208       time
209           The message timestamp.
210
211       timebreak
212           The message timestamp in short ctime format in --reltime or --human
213           output.
214
215       alert
216           The text of the message with the alert log priority.
217
218       crit
219           The text of the message with the critical log priority.
220
221       err
222           The text of the message with the error log priority.
223
224       warn
225           The text of the message with the warning log priority.
226
227       segfault
228           The text of the message that inform about segmentation fault.
229

EXIT STATUS

231       dmesg can fail reporting permission denied error. This is usually
232       caused by dmesg_restrict kernel setting, please see syslog(2) for more
233       details.
234

AUTHORS

236       Karel Zak <kzak@redhat.com>
237
238       dmesg was originally written by Theodore Ts’o <tytso@athena.mit.edu>.
239

SEE ALSO

241       terminal-colors.d(5), syslogd(8)
242

REPORTING BUGS

244       For bug reports, use the issue tracker at
245       https://github.com/karelzak/util-linux/issues.
246

AVAILABILITY

248       The dmesg command is part of the util-linux package which can be
249       downloaded from Linux Kernel Archive
250       <https://www.kernel.org/pub/linux/utils/util-linux/>.
251
252
253
254util-linux 2.37.2                 2021-07-20                          DMESG(1)
Impressum