I want to use column utility to format output of iostat in aligned columns.
I wan开发者_StackOverflowt to run something like:
vmstat 1 10 | column -t
But the output appers only after 10 sec (vmstat completes its work) and not each second.
Any ideas?
try this:
vmstat -w 1 5
this works fine in vm, but when in physic machine which has large memory the columu of cpu maybe not looks as better as in vm.
The reason this happens is that column waits to gather as much input as possible on which to base its column guesses. It has no way of knowing that the data pattern repeats every second.
You can approximate what you want to do by running this:
for i in 0 1 2 3 4 5 6 7 8 9; do iostat | column -t; sleep 1; done
EDIT
Thanks to a couple of suggestions from Dennis:
for i in {0..9} ; do iostat 1 1 | column -t; sleep 1; done
The only difference from the original is that the first header line is repeated every second. Some footwork with sed
or grep
could take care of that.
Try this
vmstat 1 10 >> /tmp/vmout.txt; tail -f /tmp/vmout.txt
精彩评论