Anyone know of a way to tail -f dmesg?
Printable View
Anyone know of a way to tail -f dmesg?
Are you asking what the file name is of the ring buffer? The only time that I know of that it gets written to is during boot time. (But I could be mistaken.) What would be the purpose of putting tail -f on it? Just curious.
tail -f <logfile>Quote:
Originally Posted by anomie
Would display the last few lines of the logfile as it keeps getting updated without having to run tail or cat again. Try it.
I am trying to have dmesg displayed in the terminal and keep getting updated without me having to do anything.
Tryfor static, I haven't got tailf here at the moment so I can't check - but you could always script something likeCode:dmesg | tail
That's just off the top of my head, you may tweak away. I'll let youhave that under the GPL !! haha :lol:Code:#!/bin/bash
while true
do dmesg | tail
sleep 3
done
Yeah, I have triedQuote:
Originally Posted by bigtomrodney
but it does not want to accept -f.Code:dmesg | tail
I know that, but I am asking what the purpose is of tail -f on the ring buffer. It only gets written to during boot time (I think). So you can tail -f on it but nothing will happen.Quote:
tail -f <logfile>
Would display the last few lines of the logfile as it keeps getting updated without having to run tail or cat again. Try it.
The ring buffer in FC should be /var/log/dmesg. Not sure what it is in other distros.
You have to tail that, not the dmesg command. (And as I said, I don't think you will be seeing anything change with it unless you are booting.)
It's interesting - under SuSE the ring buffer appears to be made up of two files.
- /var/log/messages
- /var/log/warn
However, it is not all the lines in those files; it is only the kernel messages. So when dmesg gives results under SuSE it appears to contain those found in the two files with the prefix 'kernel:'.
Your distro may be totally different.
dmesg also reports any devices plugged in or out, as mentioned it is kernel messages. trying plugging in a flash drive, and run it before and after.
Keep in mind that the '-c' flag clears the message buffer into stdout. The 'sudo' is unnecessary if you are root. If you feel this is eating too much of your CPU resource, try adding a 'sleep 1' before the loop is done. :-oCode:while true;do sudo dmesg -c;done