1DMESG(1) User Commands DMESG(1)
2
3
4
6 dmesg - print or control the kernel ring buffer
7
9 dmesg [options]
10
11 dmesg --clear
12 dmesg --read-clear [options]
13 dmesg --console-level level
14 dmesg --console-on
15 dmesg --console-off
16
18 dmesg is used to examine or control the kernel ring buffer.
19
20 The default action is to read all messages from kernel ring buffer.
21
23 The --clear, --read-clear, --console-on, --console-off and --console-
24 level options are mutually exclusive.
25
26 -C, --clear
27 Clear the ring buffer.
28
29 -c, --read-clear
30 Clear the ring buffer contents after printing.
31
32 -D, --console-off
33 Disable printing messages to the console.
34
35 -d, --show-delta
36 Display the timestamp and time delta spent between messages. If
37 used together with --notime then only the time delta without the
38 timestamp is printed.
39
40 -e, --reltime
41 Display the local time and delta in human readable format.
42
43 -E, --console-on
44 Enable printing messages to the console.
45
46 -F, --file file
47 Read log from file.
48
49 -f, --facility list
50 Restrict output to defined (comma separated) list of facilities.
51 For example
52
53 dmesg --facility=daemon
54
55 will print messages from system daemons only. For all supported
56 facilities see dmesg --help output.
57
58 -H, --human
59 Enable human readable output. See also --color, --reltime and
60 --nopager.
61
62 -h, --help
63 Print a help text and exit.
64
65 -k, --kernel
66 Print kernel messages.
67
68 -L, --color
69 Colorize important messages.
70
71 -l, --level list
72 Restrict output to defined (comma separated) list of levels.
73 For example
74
75 dmesg --level=err,warn
76
77 will print error and warning messages only. For all supported
78 levels see dmesg --help output.
79
80 -n, --console-level level
81 Set the level at which logging of messages is done to the con‐
82 sole. The level is a level number or abbreviation of the level
83 name. For all supported levels see dmesg --help output.
84
85 For example, -n 1 or -n alert prevents all messages, except
86 emergency (panic) messages, from appearing on the console. All
87 levels of messages are still written to /proc/kmsg, so sys‐
88 logd(8) can still be used to control exactly where kernel mes‐
89 sages appear. When the -n option is used, dmesg will not print
90 or clear the kernel ring buffer.
91
92 -P, --nopager
93 Do not pipe output into a pager, the pager is enabled for
94 --human output.
95
96 -r, --raw
97 Print the raw message buffer, i.e., do not strip the log level
98 prefixes.
99
100 Note that the real raw format depends on method how dmesg(1)
101 reads kernel messages. The /dev/kmsg uses different format than
102 syslog(2). For backward compatibility dmesg(1) returns data
103 always in syslog(2) format. The real raw data from /dev/kmsg is
104 possible to read for example by command 'dd if=/dev/kmsg
105 iflag=nonblock'.
106
107 -S, --syslog
108 Force to use syslog(2) kernel interface to read kernel messages.
109 The default is to use /dev/kmsg rather than syslog(2) since ker‐
110 nel 3.5.0.
111
112 -s, --buffer-size size
113 Use a buffer of size to query the kernel ring buffer. This is
114 16392 by default. (The default kernel syslog buffer size was
115 4096 at first, 8192 since 1.3.54, 16384 since 2.1.113.) If you
116 have set the kernel buffer to be larger than the default then
117 this option can be used to view the entire buffer.
118
119 -T, --ctime
120 Print human readable timestamps. The timestamp could be inaccu‐
121 rate!
122
123 The time source used for the logs is not updated after system
124 SUSPEND/RESUME.
125
126 -t, --notime
127 Do not print kernel's timestamps.
128
129 -u, --userspace
130 Print userspace messages.
131
132 -V, --version
133 Output version information and exit.
134
135 -w, --follow
136 Wait for new messages. This feature is supported on systems with
137 readable /dev/kmsg only (since kernel 3.5.0).
138
139 -x, --decode
140 Decode facility and level (priority) number to human readable
141 prefixes.
142
144 syslogd(8)
145
147 Karel Zak ⟨kzak@redhat.com⟩
148 Theodore Ts'o ⟨tytso@athena.mit.edu⟩
149
151 The dmesg command is part of the util-linux package and is available
152 from Linux Kernel Archive ⟨ftp://ftp.kernel.org/pub/linux/utils/util-
153 linux/⟩.
154
155
156
157util-linux July 2012 DMESG(1)