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