Linux – Chop headers off of vmstat command

bashlinuxvmstat

Is there a way to run the VMSTAT command (or something like it) and have a timestamp be included in the line? I know that I can pipe the output of the command and manipulate the results, but if I do that, I'll get junk information; I'm told that the first row of VMSTAT contains bogus data, and I'd be essentially getting a repeated list of first rows.

Is there a way to get this kind of data, either with VMSTAT or something similar:

20090826.134908 0  0      0 241832 120064 3023856    0    0     0     1    0     0  0  0 100  0

Thanks!
IVR Avenger

Best Answer

vmstat -n 1 | (while read; do echo "$(date +%Y%m%d.%H%M%S) $REPLY"; done) | tail -n +3
Related Topic