How do I disable messages or logging from printing on the console/virtual terminals?
You can use the command
sudo dmesg -n 1
to suppress all messages from the kernel (and its drivers) except panic messages from appearing on the console.
To fix at each boot, add the command to:
/etc/rc.local
dmesg
comes with two handy options for that:
-D, --console-off disable printing messages to console
-E, --console-on enable printing messages to console
dmesg -D
is just a shortcut for dmesg -n 1
, except that it stores the current log level, so that you can easily restore it with dmesg -E
. So it's a bit more convenient than changing the log level with dmesg -n
.
Additionally, you can check the current log level with:
$ cat /proc/sys/kernel/printk
7 4 1 7
man klogctl
for more explanations on these numbers...