]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/dmesg.1
lib/pty: reset mainloop timeout on signal
[thirdparty/util-linux.git] / sys-utils / dmesg.1
1 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
2 .\" May be distributed under the GNU General Public License
3 .TH DMESG "1" "July 2012" "util-linux" "User Commands"
4 .SH NAME
5 dmesg \- print or control the kernel ring buffer
6 .SH SYNOPSIS
7 .B dmesg
8 [options]
9 .sp
10 .B dmesg \-\-clear
11 .br
12 .BR "dmesg \-\-read\-clear " [options]
13 .br
14 .BI "dmesg \-\-console\-level " level
15 .br
16 .B dmesg \-\-console\-on
17 .br
18 .B dmesg \-\-console\-off
19 .SH DESCRIPTION
20 .B dmesg
21 is used to examine or control the kernel ring buffer.
22 .PP
23 The default action is to display all messages from the kernel ring buffer.
24 .SH OPTIONS
25 The
26 .BR \-\-clear ,
27 .BR \-\-read\-clear ,
28 .BR \-\-console\-on ,
29 .BR \-\-console\-off ,
30 and
31 .B \-\-console\-level
32 options are mutually exclusive.
33 .PP
34 .IP "\fB\-C\fR, \fB\-\-clear\fR"
35 Clear the ring buffer.
36 .IP "\fB\-c\fR, \fB\-\-read\-clear\fR"
37 Clear the ring buffer after first printing its contents.
38 .IP "\fB\-D\fR, \fB\-\-console\-off\fR"
39 Disable the printing of messages to the console.
40 .IP "\fB\-d\fR, \fB\-\-show\-delta\fR"
41 Display the timestamp and the time delta spent between messages. If used
42 together with
43 .B \-\-notime
44 then only the time delta without the timestamp is printed.
45 .IP "\fB\-E\fR, \fB\-\-console\-on\fR"
46 Enable printing messages to the console.
47 .IP "\fB\-e\fR, \fB\-\-reltime\fR"
48 Display the local time and the delta in human-readable format. Be aware that
49 conversion to the local time could be inaccurate (see \fB\-T\fR for more
50 details).
51 .IP "\fB\-F\fR, \fB\-\-file \fIfile\fR"
52 Read the syslog messages from the given
53 .IR file .
54 Note that \fB\-F\fR does not support messages in kmsg format. The old syslog format is supported only.
55 .IP "\fB\-f\fR, \fB\-\-facility \fIlist\fR"
56 Restrict output to the given (comma-separated)
57 .I list
58 of facilities. For example:
59 .PP
60 .RS 14
61 .B dmesg \-\-facility=daemon
62 .RE
63 .IP
64 will print messages from system daemons only. For all supported facilities
65 see the
66 .B \-\-help
67 output.
68 .IP "\fB\-H\fR, \fB\-\-human\fR"
69 Enable human-readable output. See also \fB\-\-color\fR, \fB\-\-reltime\fR
70 and \fB\-\-nopager\fR.
71 .IP "\fB\-k\fR, \fB\-\-kernel\fR"
72 Print kernel messages.
73 .IP "\fB\-L\fR, \fB\-\-color\fR[=\fIwhen\fR]"
74 Colorize the output. The optional argument \fIwhen\fP
75 can be \fBauto\fR, \fBnever\fR or \fBalways\fR. If the \fIwhen\fR argument is omitted,
76 it defaults to \fBauto\fR. The colors can be disabled; for the current built-in default
77 see the \fB\-\-help\fR output. See also the \fBCOLORS\fR section below.
78 .IP "\fB\-l\fR, \fB\-\-level \fIlist\fR"
79 Restrict output to the given (comma-separated)
80 .I list
81 of levels. For example:
82 .PP
83 .RS 14
84 .B dmesg \-\-level=err,warn
85 .RE
86 .IP
87 will print error and warning messages only. For all supported levels see the
88 .B \-\-help
89 output.
90 .IP "\fB\-n\fR, \fB\-\-console\-level \fIlevel\fR
91 Set the
92 .I level
93 at which printing of messages is done to the console. The
94 .I level
95 is a level number or abbreviation of the level name. For all supported
96 levels see the
97 .B \-\-help
98 output.
99 .sp
100 For example,
101 .B \-n 1
102 or
103 .B \-n emerg
104 prevents all messages, except emergency (panic) messages, from appearing on
105 the console. All levels of messages are still written to
106 .IR /proc/kmsg ,
107 so
108 .BR syslogd (8)
109 can still be used to control exactly where kernel messages appear. When the
110 .B \-n
111 option is used,
112 .B dmesg
113 will
114 .I not
115 print or clear the kernel ring buffer.
116 .IP "\fB\-\-noescape\fR"
117 The unprintable and potentially unsafe characters (e.g. broken multi-byte
118 sequences, terminal controlling chars, etc.) are escaped in format \\x<hex> for
119 security reason by default. This option disables this feature at all. It's
120 usable for example for debugging purpose together with \fB\-\-raw\fR. Be
121 careful and don't use it by default.
122 .IP "\fB\-P\fR, \fB\-\-nopager\fR"
123 Do not pipe output into a pager. A pager is enabled by default for \fB\-\-human\fR output.
124 .IP "\fB\-p\fR, \fB\-\-force\-prefix\fR"
125 Add facility, level or timestamp information to each line of a multi-line message.
126 .IP "\fB\-r\fR, \fB\-\-raw\fR"
127 Print the raw message buffer, i.e. do not strip the log-level prefixes, but
128 all unprintable characters are still escaped (see also \fB\-\-noescape\fR).
129
130 Note that the real raw format depends on the method how
131 .BR dmesg (1)
132 reads kernel messages. The /dev/kmsg device uses a different format than
133 .BR syslog (2).
134 For backward compatibility,
135 .BR dmesg (1)
136 returns data always in the
137 .BR syslog (2)
138 format. It is possible to read the real raw data from /dev/kmsg by, for example,
139 the command 'dd if=/dev/kmsg iflag=nonblock'.
140 .IP "\fB\-S\fR, \fB\-\-syslog\fR"
141 Force \fBdmesg\fR to use the
142 .BR syslog (2)
143 kernel interface to read kernel messages. The default is to use /dev/kmsg rather
144 than
145 .BR syslog (2)
146 since kernel 3.5.0.
147 .IP "\fB\-s\fR, \fB\-\-buffer\-size \fIsize\fR
148 Use a buffer of
149 .I size
150 to query the kernel ring buffer. This is 16392 by default. (The default
151 kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since
152 2.1.113.) If you have set the kernel buffer to be larger than the default,
153 then this option can be used to view the entire buffer.
154 .IP "\fB\-T\fR, \fB\-\-ctime\fR"
155 Print human-readable timestamps.
156 .IP
157 .B Be aware that the timestamp could be inaccurate!
158 The
159 .B time
160 source used for the logs is
161 .B not updated after
162 system
163 .BR SUSPEND / RESUME .
164 .IP "\fB\-t\fR, \fB\-\-notime\fR"
165 Do not print kernel's timestamps.
166 .IP "\fB\-\-time\-format\fR \fIformat\fR"
167 Print timestamps using the given \fIformat\fR, which can be
168 .BR ctime ,
169 .BR reltime ,
170 .B delta
171 or
172 .BR iso .
173 The first three formats are aliases of the time-format-specific options.
174 The
175 .B iso
176 format is a
177 .B dmesg
178 implementation of the ISO-8601 timestamp format. The purpose of this format is
179 to make the comparing of timestamps between two systems, and any other parsing,
180 easy. The definition of the \fBiso\fR timestamp is:
181 YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone offset from UTC>.
182 .IP
183 The
184 .B iso
185 format has the same issue as
186 .BR ctime :
187 the time may be inaccurate when a system is suspended and resumed.
188 .TP
189 .BR \-u , " \-\-userspace"
190 Print userspace messages.
191 .TP
192 .BR \-w , " \-\-follow"
193 Wait for new messages. This feature is supported only on systems with
194 a readable /dev/kmsg (since kernel 3.5.0).
195 .TP
196 .BR \-x , " \-\-decode"
197 Decode facility and level (priority) numbers to human-readable prefixes.
198 .TP
199 .BR \-V , " \-\-version"
200 Display version information and exit.
201 .TP
202 .BR \-h , " \-\-help"
203 Display help text and exit.
204 .SH COLORS
205 Implicit coloring can be disabled by an empty file \fI/etc/terminal-colors.d/dmesg.disable\fR.
206 See
207 .BR terminal-colors.d (5)
208 for more details about colorization configuration.
209 .PP
210 The logical color names supported by
211 .B dmesg
212 are:
213 .TP
214 .B subsys
215 The message sub-system prefix (e.g. "ACPI:").
216 .TP
217 .B time
218 The message timestamp.
219 .TP
220 .B timebreak
221 The message timestamp in short ctime format in \fB\-\-reltime\fR
222 or \fB\-\-human\fR output.
223 .TP
224 .B alert
225 The text of the message with the alert log priority.
226 .TP
227 .B crit
228 The text of the message with the critical log priority.
229 .TP
230 .B err
231 The text of the message with the error log priority.
232 .TP
233 .B warn
234 The text of the message with the warning log priority.
235 .TP
236 .B segfault
237 The text of the message that inform about segmentation fault.
238 .SH EXIT STATUS
239 .B dmesg
240 can fail reporting permission denied error. This is usually caused by
241 .B dmesg_restrict
242 kernel setting, please see
243 .BR syslog (2)
244 for more details.
245 .SH SEE ALSO
246 .BR terminal-colors.d (5),
247 .BR syslogd (8)
248 .SH AUTHORS
249 .MT kzak@redhat.com
250 Karel Zak
251 .ME
252
253 .br
254 .B dmesg
255 was originally written by
256 .MT tytso@athena.mit.edu
257 Theodore Ts'o
258 .ME
259 .SH AVAILABILITY
260 The dmesg command is part of the util-linux package and is available from
261 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
262 Linux Kernel Archive
263 .UE .