I was looking around for a way of monitoring dmesg output in realtime.
Some distros allow you to tail -f /var/log/dmesg however this stops being written in Ubuntu after boot, so that's not so useful.
I then found the watch command, which executes a command every 2 seconds (configurable if you like). Just watching dmesg fills my terminal output from the start, which is less than useful, so I use tail to shrink it down a bit. The command:
watch "dmesg | tail -20"
does exactly what I was after.
4 comments:
I think you can create following script
#!/bin/bash
while [ 1 ]; do
dmesg -c
done
And run with
./dmesg_mon >> dmesg_log
Then the dmesg will be log into file instead of console ;)
Cheers,
-Hieu
If you want to watch your kernel messages (dmesg) than tail -f kern.log
Now you can tail and log all at the same time ( this is on Ubuntu which is what you said you were using)
Thanks J!
This is perfect:
watch "dmesg | tail -20"
Super useful. Thanks!
Post a Comment