Somewhere in the past, I saw a linux box with real time dmesg terminal - i.e. you push Ctrl-Alt-F12 and a terminal with with fresh dmesg output pops out.

How can I reproduce such effect?

I know about the trick with watch command, but that's not the solution I'm thinking about.

up vote 5 down vote accepted

You're going to need to edit your /etc/syslog.conf.

Adding a line like:

kern.*          /dev/tty10

Would output all kernel info to that tty. You'll need to figure out which tty is assigned to contol-alt-f12. There are many more examples in man syslog.conf.

  • Note that, on some Ubuntu, the base install has rsyslog in place of syslog, so that the config file is /etc/rsyslog.conf, with default configuration in /etc/rsyslog.d/50-default.conf (same syntax) – ofaurax Sep 3 '13 at 9:46

You need configure this in /etc/syslog.conf (or /etc/syslog-ng.conf depending on syslog version) directing kernel messages to /dev/vc/12 (for alt-ctrl-12).

If there is a log file already, a manual solution is to do something like:

tail -f /var/log/kernel.log > /dev/vc/12

But the permanent way is to set it up for your flavor of syslog

(in my archlinux install there is a predefined rule for this in /etc/syslog-ng.conf, uncommenting it would turn exactly this feature on)

Is this not what xconsole does in X11?
Otherwise you tail -f /dev/console. If I'm wrong here, and dmesg shows more than the console, then you need to look into syslogd.
Set your /etc/syslog.conf to either send kern messages to console, or to whichever stty is attached to the alt-ctrl-F12, which should be /dev/vc/12.
So that's /etc/syslog.conf:

kern.*  /dev/vc/12

You can simply run

cat /proc/kmsg

for realtime dmesg output in current terminal

  • 3
    What does this do? One or two line answers are generally not a good format at SU. – Doktoro Reichard Oct 12 '13 at 16:42
  • I tried tail -f /proc/kmsg and then inserted a USB flash drive, but nothing was output, despite dmesg showing output – Michael Nov 9 '16 at 20:31

I think that you can configure your Linux to execute a Shell Script when you press some keys. For example for Gnome:

The shell script file will contain the dmesg command.

  • The point is, it wasn't a shortcut-induced dmesg invocation. It was a virtual terminal designated to the specific task of displaying kernel output, you couldn't modify it content in any way. – Mike Hordecki Aug 26 '09 at 17:30
  • OK, something similar to but instead a desktop background application something to launch with a keyboard shortcut – jangelfdez Aug 26 '09 at 17:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.