8

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.

5 Answers 5

7

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.

2
  • 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, 2013 at 9:46
  • On ubuntu 18.04 I also had to add syslog to the tty group, otherwise syslog doesn't have permission to write to a console -> sudo usermod -aG tty syslog Nov 7, 2019 at 14:00
2

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)

1

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
1

You can simply run

cat /proc/kmsg

for realtime dmesg output in current terminal

2
  • 3
    What does this do? One or two line answers are generally not a good format at SU. Oct 12, 2013 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, 2016 at 20:31
-1

I think that you can configure your Linux to execute a Shell Script when you press some keys. For example for Gnome: http://www.codejacked.com/create-custom-keyboard-shortcuts-in-linux/

The shell script file will contain the dmesg command.

2
  • 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. Aug 26, 2009 at 17:30
  • OK, something similar to this:ubuntuforums.org/showthread.php?t=798247 but instead a desktop background application something to launch with a keyboard shortcut
    – jangelfdez
    Aug 26, 2009 at 17:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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