Skip to content

Instantly share code, notes, and snippets.

@4piu
Created September 8, 2025 03:31
Show Gist options
  • Save 4piu/21dfd30c81aaa9ac694320d8b4512212 to your computer and use it in GitHub Desktop.
Save 4piu/21dfd30c81aaa9ac694320d8b4512212 to your computer and use it in GitHub Desktop.
Disable kernel message output on /dev/ttyS0 once user logged in. Handy if you have to work over TTY. Put this under /etc/profile.d/
if [ "$(tty)" = "/dev/ttyS0" ] && [ $(cat /proc/sys/kernel/printk | awk '{print $1}') -gt 1 ]; then
echo "Suppressing low-priority kernel messages on serial console."
dmesg -n 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment