dmesg

Print kernel (and driver) messages, control the kernel ring buffer.

Syntax
      dmesg [ -c ] [ -n level ] [ -s bufsize ]

The dmesg program allows you to print system messages from the buffer (mostly kernel and drivers loading at bootup) and can also be used to configure the kernel ring buffer.

Options
   -c          Clear the ring buffer contents after printing.

   -s bufsize  Use a buffer of size bufsize 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. 

   -n level    Set the level at which logging of messages is done to the console.
               For example, -n 1 prevents all messages, expect panic messages,
               from appearing on the console. All levels of messages are still
               written to /proc/kmsg, so syslogd(8) can still be used to control exactly
               where kernel messages appear. When the -n option is used, dmesg will not
               print or clear the kernel ring buffer.

When both options are used, only the last option on the command line will have an effect.
As it's a ring-buffer, it will automatically cycle out old information when the buffer is full.

Examples

Print all the bootup messages to a file:

$ sudo dmesg > messages.txt

Print recent messages:

$ sudo dmesg | tail -f

“If we want a love message to be heard, it has got to be sent out. To keep a lamp burning, we have to keep putting oil in it” ~ Mother Teresa

Related:
chkconfig - updates and queries runlevel information for system services
syslogd - Linux system logging utilities.
/var/log/dmesg


© Copyright SS64.com 1999-2014
Some rights reserved