Linux – How to prevent system information from being displayed on a terminal

consolekernellinuxlogsterminal

I'm working on a curses GUI that is supposed to start up automatically on boot-up in the default linux terminal (I have no X server installed). I have this working great, but I have a problem where shortly after my curses application starts, the OS will dump some information to the terminal, which messes up my GUI. Something about "read-ahead cache" pops up every time. I have also seen messages displayed when I insert a USB flash drive or some other device.

Is there a way to prevent these messages from being sent to /dev/tty1?

Best Answer

You can use the command dmesg -n1 to prevent all messages, except panic messages, from appearing on the console.

To make this change permanent, modify your /etc/sysctl.conf file to include the following setting (the first 3 is the important part).

kernel.printk = 3 4 1 3

See this post for information on the kernel.printk values.

Related Question