Clearing dmesg logs

About dmesg

dmesg is used to examine or control the kernel ring buffer. The main purpose of dmesg is to display kernel and boot messages. This simple commands can help you save & clear your old dmesg buffer.

root@fa498b2ed935:~# dmesg |tail  
[0.000000] device veth0624ab4 left promiscuous mode
[0.000000] docker0: port 1(veth0624ab4) entered disabled state
[0.000000] device veth23b8407 entered promiscuous mode
[0.000000] IPv6: ADDRCONF(NETDEV_UP): veth23b8407: link is not ready
[0.000000] IPVS: Creating netns size=2096 id=13
[0.000000] eth0: renamed from veth974a8dc
[0.000000] IPv6: ADDRCONF(NETDEV_CHANGE): veth23b8407: link becomes ready
[0.000000] docker0: port 1(veth23b8407) entered forwarding state
[0.000000] docker0: port 1(veth23b8407) entered forwarding state
[0.000000] docker0: port 1(veth23b8407) entered forwarding state

Saving dmesg logs

root@fa498b2ed935:~# dmesg > dmesg-`date +%d%m%Y`.log  

using the above command you can save your current dmesg logs in a file suffixing your current date

root@fa498b2ed935:~# ls  
dmesg-19042013.log  

Clearing dmesg logs

the below command will clear the current dmesg buffer.

root@fa498b2ed935:~# dmesg -c  

Like it? Tweet your feedback mentioning @jswapnil with hash tag #googlinux

Swapnil Jain

RHCA Level X, RHCI ♦ Solution Architect ♦ DevOps Trainer & Consultant