Related to the earlier article on kernel development, here’s one thing that I find very useful. During development I often compile, load, unload, modify, and recompile in a loop. I rarely do this on my development machine but rather in a VM or on a nearby test machine. It’s a pain to keep typing dmesg all the time. So I keep a separate terminal open with dmesg running in a loop. Actually it’s a split pain within Tmux, but that’s not important yet. Here’s what I do.

while true; do sudo dmesg -c | tee -a /tmp/dmesg.log; sleep 1; done

With this running in it’s own terminal, you can now immediately see the effect of a module load or unload without having to go through the tedium of typing dmesg and figuring out what’s been added since the last invocation. I find this quite helpful.

Also, tee is a really useful tool, read up on it if you haven’t already.