man-pages/man1/dmesg.1.html
2021-03-31 01:06:50 +01:00

392 lines
9.4 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of DMESG</TITLE>
</HEAD><BODY>
<H1>DMESG</H1>
Section: User Commands (1)<BR>Updated: July 2012<BR><A HREF="#index">Index</A>
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<A NAME="lbAB">&nbsp;</A>
<H2>NAME</H2>
dmesg - print or control the kernel ring buffer
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<B>dmesg</B>
[options]
<P>
<B>dmesg --clear</B>
<BR>
<B>dmesg --read-clear </B>[options]
<BR>
<B>dmesg --console-level </B><I>level</I>
<BR>
<B>dmesg --console-on</B>
<BR>
<B>dmesg --console-off</B>
<A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2>
<B>dmesg</B>
is used to examine or control the kernel ring buffer.
<P>
The default action is to display all messages from the kernel ring buffer.
<A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2>
The
<B>--clear</B>,
<B>--read-clear</B>,
<B>--console-on</B>,
<B>--console-off</B>,
and
<B>--console-level</B>
options are mutually exclusive.
<P>
<DL COMPACT>
<DT id="1"><B>-C</B>, <B>--clear</B><DD>
Clear the ring buffer.
<DT id="2"><B>-c</B>, <B>--read-clear</B><DD>
Clear the ring buffer after first printing its contents.
<DT id="3"><B>-D</B>, <B>--console-off</B><DD>
Disable the printing of messages to the console.
<DT id="4"><B>-d</B>, <B>--show-delta</B><DD>
Display the timestamp and the time delta spent between messages. If used
together with
<B>--notime</B>
then only the time delta without the timestamp is printed.
<DT id="5"><B>-E</B>, <B>--console-on</B><DD>
Enable printing messages to the console.
<DT id="6"><B>-e</B>, <B>--reltime</B><DD>
Display the local time and the delta in human-readable format. Be aware that
conversion to the local time could be inaccurate (see <B>-T</B> for more
details).
<DT id="7"><B>-F</B>, <B>--file </B><I>file</I><DD>
Read the syslog messages from the given
<I>file</I>.
Note that <B>-F</B> does not support messages in kmsg format. The old syslog format is supported only.
<DT id="8"><B>-f</B>, <B>--facility </B><I>list</I><DD>
Restrict output to the given (comma-separated)
<I>list</I>
of facilities. For example:
</DL>
<P>
<DL COMPACT><DT id="9"><DD>
<B>dmesg --facility=daemon</B>
</DL>
<DL COMPACT>
<DT id="10"><DD>
will print messages from system daemons only. For all supported facilities
see the
<B>--help</B>
output.
<DT id="11"><B>-H</B>, <B>--human</B><DD>
Enable human-readable output. See also <B>--color</B>, <B>--reltime</B>
and <B>--nopager</B>.
<DT id="12"><B>-k</B>, <B>--kernel</B><DD>
Print kernel messages.
<DT id="13"><B>-L</B>, <B>--color</B>[=<I>when</I>]<DD>
Colorize the output. The optional argument <I>when</I>
can be <B>auto</B>, <B>never</B> or <B>always</B>. If the <I>when</I> argument is omitted,
it defaults to <B>auto</B>. The colors can be disabled; for the current built-in default
see the <B>--help</B> output. See also the <B>COLORS</B> section below.
<DT id="14"><B>-l</B>, <B>--level </B><I>list</I><DD>
Restrict output to the given (comma-separated)
<I>list</I>
of levels. For example:
</DL>
<P>
<DL COMPACT><DT id="15"><DD>
<B>dmesg --level=err,warn</B>
</DL>
<DL COMPACT>
<DT id="16"><DD>
will print error and warning messages only. For all supported levels see the
<B>--help</B>
output.
<DT id="17"><B>-n</B>, <B>--console-level </B><I>level</I><DD>
Set the
<I>level</I>
at which printing of messages is done to the console. The
<I>level</I>
is a level number or abbreviation of the level name. For all supported
levels see the
<B>--help</B>
output.
<P>
For example,
<B>-n 1</B>
or
<B>-n emerg</B>
prevents all messages, except emergency (panic) messages, from appearing on
the console. All levels of messages are still written to
<I>/proc/kmsg</I>,
so
<B><A HREF="/cgi-bin/man/man2html?8+syslogd">syslogd</A></B>(8)
can still be used to control exactly where kernel messages appear. When the
<B>-n</B>
option is used,
<B>dmesg</B>
will
<I>not</I>
print or clear the kernel ring buffer.
<DT id="18"><B>-P</B>, <B>--nopager</B><DD>
Do not pipe output into a pager. A pager is enabled by default for <B>--human</B> output.
<DT id="19"><B>-p</B>, <B>--force-prefix</B><DD>
Add facility, level or timestamp information to each line of a multi-line message.
<DT id="20"><B>-r</B>, <B>--raw</B><DD>
Print the raw message buffer, i.e. do not strip the log-level prefixes.
<P>
Note that the real raw format depends on the method how
<B><A HREF="/cgi-bin/man/man2html?1+dmesg">dmesg</A></B>(1)
reads kernel messages. The /dev/kmsg device uses a different format than
<B><A HREF="/cgi-bin/man/man2html?2+syslog">syslog</A></B>(2).
For backward compatibility,
<B><A HREF="/cgi-bin/man/man2html?1+dmesg">dmesg</A></B>(1)
returns data always in the
<B><A HREF="/cgi-bin/man/man2html?2+syslog">syslog</A></B>(2)
format. It is possible to read the real raw data from /dev/kmsg by, for example,
the command 'dd if=/dev/kmsg iflag=nonblock'.
<DT id="21"><B>-S</B>, <B>--syslog</B><DD>
Force <B>dmesg</B> to use the
<B><A HREF="/cgi-bin/man/man2html?2+syslog">syslog</A></B>(2)
kernel interface to read kernel messages. The default is to use /dev/kmsg rather
than
<B><A HREF="/cgi-bin/man/man2html?2+syslog">syslog</A></B>(2)
since kernel 3.5.0.
<DT id="22"><B>-s</B>, <B>--buffer-size </B><I>size</I><DD>
Use a buffer of
<I>size</I>
to query the kernel ring buffer. This is 16392 by default. (The default
kernel syslog buffer size was 4096 at first, 8192 since 1.3.54, 16384 since
2.1.113.) If you have set the kernel buffer to be larger than the default,
then this option can be used to view the entire buffer.
<DT id="23"><B>-T</B>, <B>--ctime</B><DD>
Print human-readable timestamps.
<DT id="24"><DD>
<B>Be aware that the timestamp could be inaccurate!</B>
The
<B>time</B>
source used for the logs is
<B>not updated after</B>
system
<B>SUSPEND</B>/<B>RESUME</B>.
<DT id="25"><B>-t</B>, <B>--notime</B><DD>
Do not print kernel's timestamps.
<DT id="26"><B>--time-format</B> <I>format</I><DD>
Print timestamps using the given <I>format</I>, which can be
<B>ctime</B>,
<B>reltime</B>,
<B>delta</B>
or
<B>iso</B>.
The first three formats are aliases of the time-format-specific options.
The
<B>iso</B>
format is a
<B>dmesg</B>
implementation of the ISO-8601 timestamp format. The purpose of this format is
to make the comparing of timestamps between two systems, and any other parsing,
easy. The definition of the <B>iso</B> timestamp is:
YYYY-MM-DD&lt;T&gt;HH:MM:SS,&lt;microseconds&gt;&lt;-+&gt;&lt;timezone offset from UTC&gt;.
<DT id="27"><DD>
The
<B>iso</B>
format has the same issue as
<B>ctime</B>:
the time may be inaccurate when a system is suspended and resumed.
<DT id="28"><B>-u</B>,<B> --userspace</B>
<DD>
Print userspace messages.
<DT id="29"><B>-w</B>,<B> --follow</B>
<DD>
Wait for new messages. This feature is supported only on systems with
a readable /dev/kmsg (since kernel 3.5.0).
<DT id="30"><B>-x</B>,<B> --decode</B>
<DD>
Decode facility and level (priority) numbers to human-readable prefixes.
<DT id="31"><B>-V</B>,<B> --version</B>
<DD>
Display version information and exit.
<DT id="32"><B>-h</B>,<B> --help</B>
<DD>
Display help text and exit.
</DL>
<A NAME="lbAF">&nbsp;</A>
<H2>COLORS</H2>
Implicit coloring can be disabled by an empty file <I>/etc/terminal-colors.d/dmesg.disable</I>.
See
<B><A HREF="/cgi-bin/man/man2html?5+terminal-colors.d">terminal-colors.d</A></B>(5)
for more details about colorization configuration.
<P>
The logical color names supported by
<B>dmesg</B>
are:
<DL COMPACT>
<DT id="33"><B>subsys</B>
<DD>
The message sub-system prefix (e.g. &quot;ACPI:&quot;).
<DT id="34"><B>time</B>
<DD>
The message timestamp.
<DT id="35"><B>timebreak</B>
<DD>
The message timestamp in short ctime format in <B>--reltime</B>
or <B>--human</B> output.
<DT id="36"><B>alert</B>
<DD>
The text of the message with the alert log priority.
<DT id="37"><B>crit</B>
<DD>
The text of the message with the critical log priority.
<DT id="38"><B>err</B>
<DD>
The text of the message with the error log priority.
<DT id="39"><B>warn</B>
<DD>
The text of the message with the warning log priority.
<DT id="40"><B>segfault</B>
<DD>
The text of the message that inform about segmentation fault.
</DL>
<A NAME="lbAG">&nbsp;</A>
<H2>EXIT STATUS</H2>
<B>dmesg</B>
can fail reporting permission denied error. This is usually caused by
<B>dmesg_restrict</B>
kernel setting, please see
<B><A HREF="/cgi-bin/man/man2html?2+syslog">syslog</A></B>(2)
for more details.
<A NAME="lbAH">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?5+terminal-colors.d">terminal-colors.d</A></B>(5),
<B><A HREF="/cgi-bin/man/man2html?8+syslogd">syslogd</A></B>(8)
<A NAME="lbAI">&nbsp;</A>
<H2>AUTHORS</H2>
Karel Zak
<P>
<BR>
<B>dmesg</B>
was originally written by
Theodore Ts'o
<A NAME="lbAJ">&nbsp;</A>
<H2>AVAILABILITY</H2>
The dmesg command is part of the util-linux package and is available from
Linux Kernel Archive
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="41"><A HREF="#lbAB">NAME</A><DD>
<DT id="42"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="43"><A HREF="#lbAD">DESCRIPTION</A><DD>
<DT id="44"><A HREF="#lbAE">OPTIONS</A><DD>
<DT id="45"><A HREF="#lbAF">COLORS</A><DD>
<DT id="46"><A HREF="#lbAG">EXIT STATUS</A><DD>
<DT id="47"><A HREF="#lbAH">SEE ALSO</A><DD>
<DT id="48"><A HREF="#lbAI">AUTHORS</A><DD>
<DT id="49"><A HREF="#lbAJ">AVAILABILITY</A><DD>
</DL>
<HR>
This document was created by
<A HREF="/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 00:05:11 GMT, March 31, 2021
</BODY>
</HTML>