]> git.ipfire.org Git - thirdparty/util-linux.git/blob - sys-utils/dmesg.1
docs: replace FTP by HTTPS in kernel.org URLs
[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 messages from the given
53 .IR file .
54 .IP "\fB\-f\fR, \fB\-\-facility \fIlist\fR"
55 Restrict output to the given (comma-separated)
56 .I list
57 of facilities. For example:
58 .PP
59 .RS 14
60 .B dmesg \-\-facility=daemon
61 .RE
62 .IP
63 will print messages from system daemons only. For all supported facilities
64 see the
65 .B \-\-help
66 output.
67 .IP "\fB\-H\fR, \fB\-\-human\fR"
68 Enable human-readable output. See also \fB\-\-color\fR, \fB\-\-reltime\fR
69 and \fB\-\-nopager\fR.
70 .IP "\fB\-k\fR, \fB\-\-kernel\fR"
71 Print kernel messages.
72 .IP "\fB\-L\fR, \fB\-\-color\fR[=\fIwhen\fR]"
73 Colorize the output. The optional argument \fIwhen\fP
74 can be \fBauto\fR, \fBnever\fR or \fBalways\fR. If the \fIwhen\fR argument is omitted,
75 it defaults to \fBauto\fR. The colors can be disabled; for the current built-in default
76 see the \fB\-\-help\fR output. See also the \fBCOLORS\fR section below.
77 .IP "\fB\-l\fR, \fB\-\-level \fIlist\fR"
78 Restrict output to the given (comma-separated)
79 .I list
80 of levels. For example:
81 .PP
82 .RS 14
83 .B dmesg \-\-level=err,warn
84 .RE
85 .IP
86 will print error and warning messages only. For all supported levels see the
87 .B \-\-help
88 output.
89 .IP "\fB\-n\fR, \fB\-\-console\-level \fIlevel\fR
90 Set the
91 .I level
92 at which printing of messages is done to the console. The
93 .I level
94 is a level number or abbreviation of the level name. For all supported
95 levels see the
96 .B \-\-help
97 output.
98 .sp
99 For example,
100 .B \-n 1
101 or
102 .B \-n alert
103 prevents all messages, except emergency (panic) messages, from appearing on
104 the console. All levels of messages are still written to
105 .IR /proc/kmsg ,
106 so
107 .BR syslogd (8)
108 can still be used to control exactly where kernel messages appear. When the
109 .B \-n
110 option is used,
111 .B dmesg
112 will
113 .I not
114 print or clear the kernel ring buffer.
115 .IP "\fB\-P\fR, \fB\-\-nopager\fR"
116 Do not pipe output into a pager. A pager is enabled by default for \fB\-\-human\fR output.
117 .IP "\fB\-r\fR, \fB\-\-raw\fR"
118 Print the raw message buffer, i.e. do not strip the log-level prefixes.
119
120 Note that the real raw format depends on the method how
121 .BR dmesg (1)
122 reads kernel messages. The /dev/kmsg device uses a different format than
123 .BR syslog (2).
124 For backward compatibility,
125 .BR dmesg (1)
126 returns data always in the
127 .BR syslog (2)
128 format. It is possible to read the real raw data from /dev/kmsg by, for example,
129 the command 'dd if=/dev/kmsg iflag=nonblock'.
130 .IP "\fB\-S\fR, \fB\-\-syslog\fR"
131 Force \fBdmesg\fR to use the
132 .BR syslog (2)
133 kernel interface to read kernel messages. The default is to use /dev/kmsg rather
134 than
135 .BR syslog (2)
136 since kernel 3.5.0.
137 .IP "\fB\-s\fR, \fB\-\-buffer\-size \fIsize\fR
138 Use a buffer of
139 .I size
140 to query the kernel ring buffer. This is 16392 by default. (The default
141 kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since
142 2.1.113.) If you have set the kernel buffer to be larger than the default,
143 then this option can be used to view the entire buffer.
144 .IP "\fB\-T\fR, \fB\-\-ctime\fR"
145 Print human-readable timestamps.
146 .IP
147 .B Be aware that the timestamp could be inaccurate!
148 The
149 .B time
150 source used for the logs is
151 .B not updated after
152 system
153 .BR SUSPEND / RESUME .
154 .IP "\fB\-t\fR, \fB\-\-notime\fR"
155 Do not print kernel's timestamps.
156 .IP "\fB\-\-time\-format\fR \fIformat\fR"
157 Print timestamps using the given \fIformat\fR, which can be
158 .BR ctime ,
159 .BR reltime ,
160 .BR delta
161 or
162 .BR iso .
163 The first three formats are aliases of the time-format-specific options.
164 The
165 .B iso
166 format is a
167 .B dmesg
168 implementation of the ISO-8601 timestamp format. The purpose of this format is
169 to make the comparing of timestamps between two systems, and any other parsing,
170 easy. The definition of the \fBiso\fR timestamp is:
171 YYYY-MM-DD<T>HH:MM:SS,<microseconds><-+><timezone offset from UTC>.
172 .IP
173 The
174 .B iso
175 format has the same issue as
176 .BR ctime :
177 the time may be inaccurate when a system is suspended and resumed.
178 .TP
179 .BR \-u , " \-\-userspace"
180 Print userspace messages.
181 .TP
182 .BR \-w , " \-\-follow"
183 Wait for new messages. This feature is supported only on systems with
184 a readable /dev/kmsg (since kernel 3.5.0).
185 .TP
186 .BR \-x , " \-\-decode"
187 Decode facility and level (priority) numbers to human-readable prefixes.
188 .TP
189 .BR \-V , " \-\-version"
190 Display version information and exit.
191 .TP
192 .BR \-h , " \-\-help"
193 Display help text and exit.
194 .SH COLORS
195 Implicit coloring can be disabled by an empty file \fI/etc/terminal-colors.d/dmesg.disable\fR.
196 See
197 .BR terminal-colors.d (5)
198 for more details about colorization configuration.
199 .PP
200 The logical color names supported by
201 .B dmesg
202 are:
203 .TP
204 .B subsys
205 The message sub-system prefix (e.g. "ACPI:").
206 .TP
207 .B time
208 The message timestamp.
209 .TP
210 .B timebreak
211 The message timestamp in short ctime format in \fB\-\-reltime\fR
212 or \fB\-\-human\fR output.
213 .TP
214 .B alert
215 The text of the message with the alert log priority.
216 .TP
217 .B crit
218 The text of the message with the critical log priority.
219 .TP
220 .B err
221 The text of the message with the error log priority.
222 .TP
223 .B warn
224 The text of the message with the warning log priority.
225 .TP
226 .B segfault
227 The text of the message that inform about segmentation fault.
228
229 .SH SEE ALSO
230 .BR terminal-colors.d (5),
231 .BR syslogd (8)
232 .SH AUTHORS
233 .MT kzak@redhat.com
234 Karel Zak
235 .ME
236
237 .br
238 .B dmesg
239 was originally written by
240 .MT tytso@athena.mit.edu
241 Theodore Ts'o
242 .ME
243 .SH AVAILABILITY
244 The dmesg command is part of the util-linux package and is available from
245 .UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
246 Linux Kernel Archive
247 .UE .